summaryrefslogtreecommitdiffstats
path: root/nest/config.Y
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-12-01 16:10:21 +0100
committerMartin Mares <mj@ucw.cz>1999-12-01 16:10:21 +0100
commit730f2e2c8c29b3461caa096fa514cbf71f84e51b (patch)
tree0a01f3aeb128be3746f67ee9c9adc1c8c62013d7 /nest/config.Y
parent04a60c689aeb10fafa9919bcff5f8391e0f3a158 (diff)
downloadbird-730f2e2c8c29b3461caa096fa514cbf71f84e51b.tar
bird-730f2e2c8c29b3461caa096fa514cbf71f84e51b.zip
Added dumping of routing tables (`show route'). This includes filtering.
Diffstat (limited to 'nest/config.Y')
-rw-r--r--nest/config.Y43
1 files changed, 38 insertions, 5 deletions
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 <r> rtable
%type <p> password_list password_begin
%type <s> optsym
+%type <ra> r_args
CF_GRAMMAR
@@ -201,12 +202,49 @@ CF_CLI(SHOW PROTOCOLS, optsym, [<name>], [[Show routing protocols]])
CF_CLI(SHOW PROTOCOLS VERBOSE, optsym, [<name>], [[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, [<prefix>] [table <t>] [filter <f>] [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, <subsystem>, [[Tests different subsystems]])
CF_CLI(TEST LEDS, NUM, <N>, [[Flash each LED <N> 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 */