diff options
Diffstat (limited to 'nest/config.Y')
-rw-r--r-- | nest/config.Y | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/nest/config.Y b/nest/config.Y index ec7217b0..0bb8ca51 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -91,7 +91,7 @@ CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OF CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, VRF, DEFAULT, TABLE, STATES, ROUTES, FILTERS) CF_KEYWORDS(IPV4, IPV6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6, SADR, MPLS) CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED) -CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES) +CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, CHANNELS, INTERFACES) CF_KEYWORDS(ALGORITHM, KEYED, HMAC, MD5, SHA1, SHA256, SHA384, SHA512) CF_KEYWORDS(PRIMARY, STATS, COUNT, BY, FOR, COMMANDS, PREEXPORT, NOEXPORT, EXPORTED, GENERATE) CF_KEYWORDS(BGP, PASSWORDS, DESCRIPTION, SORTED) @@ -123,7 +123,8 @@ CF_ENUM_PX(T_ENUM_AF, AF_, AFI_, IPV4, IPV6) %type <cl> limit_spec %type <net> r_args_for_val %type <net_ptr> r_args_for -%type <t> r_args_channel +%type <t> channel_sym +%type <c> channel_arg CF_GRAMMAR @@ -247,7 +248,7 @@ channel_start: net_type $$ = this_channel = channel_config_get(NULL, net_label[$1], $1, this_proto); }; -channel_item: +channel_item_: TABLE rtable { if (this_channel->net_type && ($2->addr_type != this_channel->net_type)) cf_error("Incompatible table type"); @@ -262,6 +263,12 @@ channel_item: | IMPORT KEEP FILTERED bool { this_channel->in_keep_filtered = $4; } ; +/* To avoid grammar collision in Pipe protocol */ +channel_item: + channel_item_ + | DEBUG debug_mask { this_channel->debug = $2; } + ; + channel_opts: /* empty */ | channel_opts channel_item ';' @@ -310,6 +317,7 @@ conf: debug_default ; debug_default: DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; } + | DEBUG CHANNELS debug_mask { new_config->channel_default_debug = $3; } | DEBUG COMMANDS expr { new_config->cli_debug = $3; } ; @@ -604,26 +612,14 @@ r_args: rt_show_add_table($$, t->table); $$->tables_defined_by = RSD_TDB_ALL; } - | r_args IMPORT TABLE CF_SYM_KNOWN '.' r_args_channel { - cf_assert_symbol($4, SYM_PROTO); - $$ = $1; - struct proto_config *cf = $4->proto; - if (!cf->proto) cf_error("%s is not a protocol", $4->name); - struct channel *c = proto_find_channel_by_name(cf->proto, $6); - if (!c) cf_error("Channel %s.%s not found", $4->name, $6); - if (!c->in_table) cf_error("No import table in channel %s.%s", $4->name, $6); - rt_show_add_table($$, c->in_table); + | r_args IMPORT TABLE channel_arg { + if (!$4->in_table) cf_error("No import table in channel %s.%s", $4->proto->name, $4->name); + rt_show_add_table($$, $4->in_table); $$->tables_defined_by = RSD_TDB_DIRECT; } - | r_args EXPORT TABLE CF_SYM_KNOWN '.' r_args_channel { - cf_assert_symbol($4, SYM_PROTO); - $$ = $1; - struct proto_config *cf = $4->proto; - if (!cf->proto) cf_error("%s is not a protocol", $4->name); - struct channel *c = proto_find_channel_by_name(cf->proto, $6); - if (!c) cf_error("Channel %s.%s not found", $4->name, $6); - if (!c->out_table) cf_error("No export table in channel %s.%s", $4->name, $6); - rt_show_add_table($$, c->out_table); + | r_args EXPORT TABLE channel_arg { + if (!$4->out_table) cf_error("No export table in channel %s.%s", $4->proto->name, $4->name); + rt_show_add_table($$, $4->out_table); $$->tables_defined_by = RSD_TDB_DIRECT; } | r_args FILTER filter { @@ -658,15 +654,11 @@ r_args: $$->export_protocol = c->proto; $$->tables_defined_by = RSD_TDB_INDIRECT; } - | r_args export_mode CF_SYM_KNOWN '.' r_args_channel { - cf_assert_symbol($3, SYM_PROTO); - struct proto_config *c = (struct proto_config *) $3->proto; + | r_args export_mode channel_arg { $$ = $1; if ($$->export_mode) cf_error("Export specified twice"); - if (!c->proto) cf_error("%s is not a protocol", $3->name); $$->export_mode = $2; - $$->export_channel = proto_find_channel_by_name(c->proto, $5); - if (!$$->export_channel) cf_error("Export channel not found"); + $$->export_channel = $3; $$->tables_defined_by = RSD_TDB_INDIRECT; } | r_args PROTOCOL CF_SYM_KNOWN { @@ -735,7 +727,7 @@ export_mode: ; /* This is ugly hack */ -r_args_channel: +channel_sym: IPV4 { $$ = "ipv4"; } | IPV4_MC { $$ = "ipv4-mc"; } | IPV4_MPLS { $$ = "ipv4-mpls"; } @@ -758,6 +750,16 @@ r_args_channel: | SEC { $$ = "sec"; } ; +channel_arg: + CF_SYM_KNOWN '.' channel_sym { + cf_assert_symbol($1, SYM_PROTO); + struct proto *p = $1->proto->proto; + if (!p) cf_error("%s is not a protocol", $1->name); + $$ = proto_find_channel_by_name(p, $3); + if (!$$) cf_error("Channel %s.%s not found", $1->name, $3); + } + ; + CF_CLI_HELP(SHOW SYMBOLS, ..., [[Show all known symbolic names]]) CF_CLI(SHOW SYMBOLS, sym_args, [table|filter|function|protocol|template|<symbol>], [[Show all known symbolic names]]) { cmd_show_symbols($3); } ; @@ -832,8 +834,13 @@ CF_CLI(RELOAD OUT, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protoc { proto_apply_cmd($3, proto_cmd_reload, 1, CMD_RELOAD_OUT); } ; CF_CLI_HELP(DEBUG, ..., [[Control protocol debugging via BIRD logs]]) -CF_CLI(DEBUG, proto_patt debug_mask, (<protocol> | \"<pattern>\" | all) (all | off | { states|routes|filters|interfaces|events|packets [, ...] }), [[Control protocol debugging via BIRD logs]]) -{ proto_apply_cmd($2, proto_cmd_debug, 1, $3); } ; +CF_CLI(DEBUG, debug_args, (<protocol> | <channel> | \"<pattern>\" | all) (all | off | { states|routes|filters|interfaces|events|packets [, ...] }), [[Control protocol debugging via BIRD logs]]) +{ /* Done in debug_args */ }; + +debug_args: + proto_patt debug_mask { proto_apply_cmd($1, proto_cmd_debug, 1, $2); } + | channel_arg debug_mask { channel_cmd_debug($1, $2); } + ; CF_CLI_HELP(MRTDUMP, ..., [[Control protocol debugging via MRTdump files]]) CF_CLI(MRTDUMP, proto_patt mrtdump_mask, (<protocol> | \"<pattern>\" | all) (all | off | { states|messages [, ...] }), [[Control protocol debugging via MRTdump format]]) |