diff --git a/conf/confbase.Y b/conf/confbase.Y index 14893f4..c1673cf 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -50,6 +50,7 @@ CF_DECLS struct f_path_mask *h; struct password_item *p; struct rt_show_data *ra; + struct sym_show_data *sd; struct iface *iface; void *g; bird_clock_t time; diff --git a/nest/cmds.c b/nest/cmds.c index 8ac3209..cbf505c 100644 --- a/nest/cmds.c +++ b/nest/cmds.c @@ -7,6 +7,7 @@ */ #include "nest/bird.h" +#include "nest/route.h" #include "nest/cli.h" #include "conf/conf.h" #include "nest/cmds.h" @@ -35,16 +36,34 @@ cmd_show_status(void) } void -cmd_show_symbols(struct symbol *sym) +cmd_show_symbols(struct sym_show_data *sd) { int pos = 0; + struct symbol *sym = sd->sym; if (sym) cli_msg(1010, "%s\t%s", sym->name, cf_symbol_class_name(sym)); else { while (sym = cf_walk_symbols(config, sym, &pos)) - cli_msg(-1010, "%s\t%s", sym->name, cf_symbol_class_name(sym)); + { + /* Save original output */ + if (!sd->type) + { + cli_msg(-1010, "%s\t%s", sym->name, cf_symbol_class_name(sym)); + continue; + } + + if (sd->type != sym->class) + continue; + + switch (sym->class) + { + default: + cli_msg(-1010, "%s\t\t%s", sym->name, cf_symbol_class_name(sym)); + } + + } cli_msg(0, ""); } } diff --git a/nest/cmds.h b/nest/cmds.h index 3b86a92..8b0bff7 100644 --- a/nest/cmds.h +++ b/nest/cmds.h @@ -6,6 +6,11 @@ * Can be freely distributed and used under the terms of the GNU GPL. */ +struct sym_show_data { + int type; /* Symbols type to show */ + struct symbol *sym; +}; + void cmd_show_status(void); -void cmd_show_symbols(struct symbol *sym); +void cmd_show_symbols(struct sym_show_data *sym); void cmd_show_memory(void); diff --git a/nest/config.Y b/nest/config.Y index 3fcfa52..5aae8d3 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -59,6 +59,7 @@ CF_ENUM(T_ENUM_RTD, RTD_, ROUTER, DEVICE, BLACKHOLE, UNREACHABLE, PROHIBIT, MULT %type rtable %type optsym %type r_args +%type sym_args %type proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_or_preexport %type proto_patt proto_patt2 @@ -432,9 +433,21 @@ export_or_preexport: | EXPORT { $$ = 2; } ; -CF_CLI(SHOW SYMBOLS, optsym, [], [[Show all known symbolic names]]) +CF_CLI(SHOW SYMBOLS, sym_args, [table|filter|function|protocol|template|], [[Show all known symbolic names]]) { cmd_show_symbols($3); } ; +sym_args: + /* empty */ { + $$ = cfg_allocz(sizeof(struct sym_show_data)); + } + | sym_args TABLE { $$->type = SYM_TABLE; } + | sym_args FUNCTION { $$->type = SYM_FUNCTION; } + | sym_args FILTER { $$->type = SYM_FILTER; } + | sym_args TEMPLATE { $$->type = SYM_TEMPLATE; } + | sym_args PROTOCOL { $$->type = SYM_PROTO; } + | sym_args SYM { $$->sym = $2; } + ; + CF_CLI_HELP(DUMP, ..., [[Dump debugging information]]) CF_CLI(DUMP RESOURCES,,, [[Dump all allocated resource]]) { rdump(&root_pool); cli_msg(0, ""); } ;