From 730f2e2c8c29b3461caa096fa514cbf71f84e51b Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 1 Dec 1999 15:10:21 +0000 Subject: Added dumping of routing tables (`show route'). This includes filtering. --- nest/config.Y | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'nest/config.Y') diff --git a/nest/config.Y b/nest/config.Y index b807085..89177a7 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -28,6 +28,7 @@ CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIREC %type rtable %type

password_list password_begin %type optsym +%type r_args CF_GRAMMAR @@ -201,12 +202,49 @@ CF_CLI(SHOW PROTOCOLS, optsym, [], [[Show routing protocols]]) CF_CLI(SHOW PROTOCOLS VERBOSE, optsym, [], [[Show routing protocol details]]) { proto_show($4, 1); } ; +optsym: + SYM + | /* empty */ { $$ = NULL; } + ; + CF_CLI(SHOW INTERFACES,,, [[Show network interfaces]]) { if_show(); } ; CF_CLI(SHOW INTERFACES SUMMARY,,, [[Show summary of network interfaces]]) { if_show_summary(); } ; +CF_CLI(SHOW ROUTE, r_args, [] [table ] [filter ] [all], [[Show routing table]]) +{ rt_show($3); } ; + +r_args: + /* empty */ { + $$ = cfg_allocz(sizeof(struct rt_show_data)); + $$->pxlen = 256; + $$->filter = FILTER_ACCEPT; + $$->table = config->master_rtc->table; + } + | r_args IPA pxlen { + $$ = $1; + if ($$->pxlen != 256) cf_error("Only one prefix expected"); + if (!ip_is_prefix($2, $3)) cf_error("Invalid prefix"); + $$->prefix = $2; + $$->pxlen = $3; + } + | r_args TABLE SYM { + $$ = $1; + if ($3->class != SYM_TABLE) cf_error("%s is not a table", $3->name); + $$->table = ((struct rtable_config *)$3->def)->table; + } + | r_args FILTER filter { + $$ = $1; + $$->filter = $3; + } + | r_args ALL { + $$ = $1; + $$->verbose = 1; + } + ; + /* FIXME: These are examples. Remove them soon. */ CF_CLI_HELP(TEST, , [[Tests different subsystems]]) CF_CLI(TEST LEDS, NUM, , [[Flash each LED times]]) { cli_msg(0, "%d", $3); } ; @@ -218,11 +256,6 @@ CF_CLI(TEST LONG,,, [[Test long replies]]) { cli_msg(-2, "Start"); } ; -optsym: - SYM - | /* empty */ { $$ = NULL; } - ; - CF_CODE /* FIXME: Test only, remove */ -- cgit v1.2.3