2 * BIRD -- Core Configuration
4 * (c) 1998--2000 Martin Mares <mj@ucw.cz>
5 * (c) 2004 Ondrej Filip <feela@network.cz>
7 * Can be freely distributed and used under the terms of the GNU GPL.
12 #include "nest/rt-dev.h"
13 #include "nest/password.h"
14 #include "nest/cmds.h"
15 #include "lib/lists.h"
20 static struct proto_config *this_proto;
21 static struct channel_config *this_channel;
22 static struct iface_patt *this_ipatt;
23 static struct iface_patt_node *this_ipn;
24 /* static struct roa_table_config *this_roa_table; */
25 static list *this_p_list;
26 static struct password_item *this_p_item;
27 static int password_id;
30 iface_patt_check(void)
32 struct iface_patt_node *pn;
34 WALK_LIST(pn, this_ipatt->ipn_list)
35 if (!pn->pattern || pn->prefix.type)
36 cf_error("Interface name/mask expected, not IP prefix");
49 list *rv = this_p_list;
55 proto_postconfig(void)
57 CALL(this_proto->protocol->postconfig, this_proto);
63 #define DIRECT_CFG ((struct rt_dev_config *) this_proto)
67 CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
68 CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, VRF, TABLE, STATES, ROUTES, FILTERS)
69 CF_KEYWORDS(IPV4, IPV6, VPN4, VPN6, ROA4, ROA6)
70 CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED)
71 CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
72 CF_KEYWORDS(ALGORITHM, KEYED, HMAC, MD5, SHA1, SHA256, SHA384, SHA512)
73 CF_KEYWORDS(PRIMARY, STATS, COUNT, BY, FOR, COMMANDS, PREEXPORT, NOEXPORT, GENERATE)
74 CF_KEYWORDS(BGP, PASSWORDS, DESCRIPTION, SORTED)
75 CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, IGP_METRIC, CLASS, DSCP)
76 CF_KEYWORDS(TIMEFORMAT, ISO, SHORT, LONG, ROUTE, PROTOCOL, BASE, LOG, S, MS, US)
77 CF_KEYWORDS(GRACEFUL, RESTART, WAIT, MAX, FLUSH, AS)
79 /* For r_args_channel */
80 CF_KEYWORDS(IPV4, IPV4_MC, IPV4_MPLS, IPV6, IPV6_MC, IPV6_MPLS, VPN4, VPN4_MC, VPN4_MPLS, VPN6, VPN6_MC, VPN6_MPLS, ROA4, ROA6, FLOW4, FLOW6, MPLS, PRI, SEC)
82 CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT,
83 RIP, OSPF, OSPF_IA, OSPF_EXT1, OSPF_EXT2, BGP, PIPE, BABEL)
84 CF_ENUM(T_ENUM_SCOPE, SCOPE_, HOST, LINK, SITE, ORGANIZATION, UNIVERSE, UNDEFINED)
85 CF_ENUM(T_ENUM_RTD, RTD_, UNICAST, BLACKHOLE, UNREACHABLE, PROHIBIT)
86 CF_ENUM(T_ENUM_ROA, ROA_, UNKNOWN, VALID, INVALID)
94 %type <i> proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_mode limit_action net_type table_sorted tos password_algorithm
95 %type <ps> proto_patt proto_patt2
96 %type <cc> channel_start proto_channel
98 %type <net> r_args_for_val
99 %type <net_ptr> r_args_for
100 %type <t> r_args_channel
104 /* Setting of router ID */
106 CF_ADDTO(conf, rtrid)
109 ROUTER ID idval ';' { new_config->router_id = $3; }
110 | ROUTER ID FROM iface_patt ';' { new_config->router_id_from = this_ipatt; }
115 | '(' term ')' { $$ = f_eval_int($2); }
116 | IP4 { $$ = ip4_to_u32($1); }
118 if ($1->class == (SYM_CONSTANT | T_INT) || $1->class == (SYM_CONSTANT | T_QUAD))
120 else if (($1->class == (SYM_CONSTANT | T_IP)) && ipa_is_ip4(SYM_VAL($1).ip))
121 $$ = ipa_to_u32(SYM_VAL($1).ip);
123 cf_error("Number or IPv4 address constant expected");
127 CF_ADDTO(conf, gr_opts)
129 gr_opts: GRACEFUL RESTART WAIT expr ';' { new_config->gr_wait = $4; } ;
132 /* Network types (for tables, channels) */
135 IPV4 { $$ = NET_IP4; }
136 | IPV6 { $$ = NET_IP6; }
137 | VPN4 { $$ = NET_VPN4; }
138 | VPN6 { $$ = NET_VPN6; }
139 | ROA4 { $$ = NET_ROA4; }
140 | ROA6 { $$ = NET_ROA6; }
141 | FLOW4{ $$ = NET_FLOW4; }
142 | FLOW6{ $$ = NET_FLOW6; }
143 | MPLS { $$ = NET_MPLS; }
146 CF_ENUM(T_ENUM_NETTYPE, NET_, IP4, IP6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6)
149 /* Creation of routing tables */
151 CF_ADDTO(conf, table)
158 table: net_type TABLE SYM table_sorted {
159 struct rtable_config *cf;
160 cf = rt_new_table($3, $1);
166 /* Definition of protocols */
168 CF_ADDTO(conf, proto { proto_postconfig(); })
171 PROTOCOL { $$ = SYM_PROTO; }
172 | TEMPLATE { $$ = SYM_TEMPLATE; }
177 struct symbol *s = cf_default_name(this_proto->protocol->template, &this_proto->protocol->name_counter);
178 s->class = this_proto->class;
180 this_proto->name = s->name;
183 cf_define_symbol($1, this_proto->class, this_proto);
184 this_proto->name = $1->name;
187 struct symbol *s = cf_default_name(this_proto->protocol->template, &this_proto->protocol->name_counter);
188 s->class = this_proto->class;
190 this_proto->name = s->name;
192 if (($2->class != SYM_TEMPLATE) && ($2->class != SYM_PROTO)) cf_error("Template or protocol name expected");
193 proto_copy_config(this_proto, $2->def);
196 cf_define_symbol($1, this_proto->class, this_proto);
197 this_proto->name = $1->name;
199 if (($3->class != SYM_TEMPLATE) && ($3->class != SYM_PROTO)) cf_error("Template or protocol name expected");
200 proto_copy_config(this_proto, $3->def);
206 | DISABLED bool { this_proto->disabled = $2; }
207 | DEBUG debug_mask { this_proto->debug = $2; }
208 | MRTDUMP mrtdump_mask { this_proto->mrtdump = $2; }
209 | ROUTER ID idval { this_proto->router_id = $3; }
210 | DESCRIPTION text { this_proto->dsc = $2; }
211 | VRF text { this_proto->vrf = if_get_by_name($2); }
215 channel_start: net_type
217 $$ = this_channel = channel_config_get(NULL, net_label[$1], $1, this_proto);
222 if (this_channel->net_type && ($2->addr_type != this_channel->net_type))
223 cf_error("Incompatible table type");
224 this_channel->table = $2;
226 | IMPORT imexport { this_channel->in_filter = $2; }
227 | EXPORT imexport { this_channel->out_filter = $2; }
228 | RECEIVE LIMIT limit_spec { this_channel->rx_limit = $3; }
229 | IMPORT LIMIT limit_spec { this_channel->in_limit = $3; }
230 | EXPORT LIMIT limit_spec { this_channel->out_limit = $3; }
231 | PREFERENCE expr { this_channel->preference = $2; check_u16($2); }
232 | IMPORT KEEP FILTERED bool { this_channel->in_keep_filtered = $4; }
237 | channel_opts channel_item ';'
242 | '{' channel_opts '}'
247 if (!this_channel->table)
248 cf_error("Routing table not specified");
253 proto_channel: channel_start channel_opt_list channel_end;
258 if ($1->class != SYM_TABLE) cf_error("Table expected");
264 FILTER filter { $$ = $2; }
266 | ALL { $$ = FILTER_ACCEPT; }
267 | NONE { $$ = FILTER_REJECT; }
271 /* default */ { $$ = PLA_DISABLE; }
272 | ACTION WARN { $$ = PLA_WARN; }
273 | ACTION BLOCK { $$ = PLA_BLOCK; }
274 | ACTION RESTART { $$ = PLA_RESTART; }
275 | ACTION DISABLE { $$ = PLA_DISABLE; }
279 expr limit_action { $$ = (struct channel_limit){ .limit = $1, $$.action = $2 }; }
280 | OFF { $$ = (struct channel_limit){}; }
284 CF_ADDTO(conf, debug_default)
287 DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; }
288 | DEBUG COMMANDS expr { new_config->cli_debug = $3; }
291 /* MRTDUMP PROTOCOLS is in systep/unix/config.Y */
293 CF_ADDTO(conf, timeformat_base)
296 ROUTE { $$ = &new_config->tf_route; }
297 | PROTOCOL { $$ = &new_config->tf_proto; }
298 | BASE { $$ = &new_config->tf_base; }
299 | LOG { $$ = &new_config->tf_log; }
303 timeformat_which TEXT { *$1 = (struct timeformat){$2, NULL, 0}; }
304 | timeformat_which TEXT expr TEXT { *$1 = (struct timeformat){$2, $4, (s64) $3 S_}; }
305 | timeformat_which ISO SHORT { *$1 = TM_ISO_SHORT_S; }
306 | timeformat_which ISO SHORT MS { *$1 = TM_ISO_SHORT_MS; }
307 | timeformat_which ISO SHORT US { *$1 = TM_ISO_SHORT_US; }
308 | timeformat_which ISO LONG { *$1 = TM_ISO_LONG_S; }
309 | timeformat_which ISO LONG MS { *$1 = TM_ISO_LONG_MS; }
310 | timeformat_which ISO LONG US { *$1 = TM_ISO_LONG_US; }
314 TIMEFORMAT timeformat_spec ';'
318 /* Interface patterns */
320 iface_patt_node_init:
322 struct iface_patt_node *ipn = cfg_allocz(sizeof(struct iface_patt_node));
323 add_tail(&this_ipatt->ipn_list, NODE ipn);
328 iface_patt_node_body:
329 TEXT { this_ipn->pattern = $1; /* this_ipn->prefix stays zero */ }
330 | opttext net_or_ipa { this_ipn->pattern = $1; this_ipn->prefix = $2; }
334 { this_ipn->positive = 1; }
335 | '-' { this_ipn->positive = 0; }
339 iface_patt_node_init iface_negate iface_patt_node_body
345 | iface_patt_list ',' iface_patt_node
348 /* For name/mask-only iface patterns */
349 iface_patt_list_nopx: iface_patt_list { iface_patt_check(); }
352 /* Generic this_ipatt init */
353 this_ipatt = cfg_allocz(sizeof(struct iface_patt));
354 init_list(&this_ipatt->ipn_list);
359 iface_patt_init iface_patt_list
363 CLASS expr { $$ = $2 & 0xfc; if ($2 > 255) cf_error("TX class must be in range 0-255"); }
364 | DSCP expr { $$ = ($2 & 0x3f) << 2; if ($2 > 63) cf_error("TX DSCP must be in range 0-63"); }
367 /* Direct device route protocol */
369 CF_ADDTO(proto, dev_proto '}')
371 dev_proto_start: proto_start DIRECT {
372 this_proto = proto_config_new(&proto_device, $1);
373 init_list(&DIRECT_CFG->iface_list);
378 dev_proto_start proto_name '{'
379 | dev_proto proto_item ';'
380 | dev_proto proto_channel ';'
381 | dev_proto dev_iface_patt ';'
382 | dev_proto CHECK LINK bool ';' { DIRECT_CFG->check_link = $4; }
387 this_ipatt = cfg_allocz(sizeof(struct iface_patt));
388 add_tail(&DIRECT_CFG->iface_list, NODE this_ipatt);
389 init_list(&this_ipatt->ipn_list);
394 INTERFACE dev_iface_init iface_patt_list
402 | '{' debug_list '}' { $$ = $2; }
407 | debug_list ',' debug_flag { $$ = $1 | $3; }
411 STATES { $$ = D_STATES; }
412 | ROUTES { $$ = D_ROUTES; }
413 | FILTERS { $$ = D_FILTERS; }
414 | INTERFACES { $$ = D_IFACES; }
415 | EVENTS { $$ = D_EVENTS; }
416 | PACKETS { $$ = D_PACKETS; }
424 | '{' mrtdump_list '}' { $$ = $2; }
429 | mrtdump_list ',' mrtdump_flag { $$ = $1 | $3; }
433 STATES { $$ = MD_STATES; }
434 | MESSAGES { $$ = MD_MESSAGES; }
440 PASSWORDS '{' password_items '}'
446 | password_item ';' password_items
450 password_item_begin '{' password_item_params '}'
451 | password_item_begin
457 this_p_list = cfg_alloc(sizeof(list));
458 init_list(this_p_list);
461 this_p_item = cfg_alloc(sizeof (struct password_item));
462 this_p_item->password = $2;
463 this_p_item->length = strlen($2);
464 this_p_item->genfrom = 0;
465 this_p_item->gento = TIME_INFINITY;
466 this_p_item->accfrom = 0;
467 this_p_item->accto = TIME_INFINITY;
468 this_p_item->id = password_id++;
469 this_p_item->alg = ALG_UNDEFINED;
470 add_tail(this_p_list, &this_p_item->n);
474 password_item_params:
476 | GENERATE FROM time ';' password_item_params { this_p_item->genfrom = $3; }
477 | GENERATE TO time ';' password_item_params { this_p_item->gento = $3; }
478 | ACCEPT FROM time ';' password_item_params { this_p_item->accfrom = $3; }
479 | ACCEPT TO time ';' password_item_params { this_p_item->accto = $3; }
480 | FROM time ';' password_item_params { this_p_item->genfrom = this_p_item->accfrom = $2; }
481 | TO time ';' password_item_params { this_p_item->gento = this_p_item->accto = $2; }
482 | ID expr ';' password_item_params { this_p_item->id = $2; if ($2 <= 0) cf_error("Password ID has to be greated than zero."); }
483 | ALGORITHM password_algorithm ';' password_item_params { this_p_item->alg = $2; }
487 KEYED MD5 { $$ = ALG_MD5; }
488 | KEYED SHA1 { $$ = ALG_SHA1; }
489 | KEYED SHA256 { $$ = ALG_SHA256; }
490 | KEYED SHA384 { $$ = ALG_SHA384; }
491 | KEYED SHA512 { $$ = ALG_SHA512; }
492 | HMAC MD5 { $$ = ALG_HMAC_MD5; }
493 | HMAC SHA1 { $$ = ALG_HMAC_SHA1; }
494 | HMAC SHA256 { $$ = ALG_HMAC_SHA256; }
495 | HMAC SHA384 { $$ = ALG_HMAC_SHA384; }
496 | HMAC SHA512 { $$ = ALG_HMAC_SHA512; }
500 CF_CLI_HELP(SHOW, ..., [[Show status information]])
502 CF_CLI(SHOW STATUS,,, [[Show router status]])
503 { cmd_show_status(); } ;
505 CF_CLI(SHOW MEMORY,,, [[Show memory usage]])
506 { cmd_show_memory(); } ;
508 CF_CLI(SHOW PROTOCOLS, proto_patt2, [<protocol> | \"<pattern>\"], [[Show routing protocols]])
509 { proto_apply_cmd($3, proto_cmd_show, 0, 0); } ;
511 CF_CLI(SHOW PROTOCOLS ALL, proto_patt2, [<protocol> | \"<pattern>\"], [[Show routing protocol details]])
512 { proto_apply_cmd($4, proto_cmd_show, 0, 1); } ;
516 | /* empty */ { $$ = NULL; }
519 CF_CLI(SHOW INTERFACES,,, [[Show network interfaces]])
522 CF_CLI(SHOW INTERFACES SUMMARY,,, [[Show summary of network interfaces]])
523 { if_show_summary(); } ;
525 CF_CLI_HELP(SHOW ROUTE, ..., [[Show routing table]])
526 CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [filter <f>|where <cond>] [all] [primary] [filtered] [(export|preexport|noexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
531 $$ = cfg_allocz(sizeof(struct rt_show_data));
532 init_list(&($$->tables));
533 $$->filter = FILTER_ACCEPT;
537 if ($$->addr) cf_error("Only one prefix expected");
540 | r_args FOR r_args_for {
542 if ($$->addr) cf_error("Only one prefix expected");
548 if ($3->class != SYM_TABLE) cf_error("%s is not a table", $3->name);
549 rt_show_add_table($$, ((struct rtable_config *)$3->def)->table);
550 $$->tables_defined_by = RSD_TDB_DIRECT;
553 struct rtable_config *t;
555 WALK_LIST(t, config->tables)
556 rt_show_add_table($$, t->table);
557 $$->tables_defined_by = RSD_TDB_ALL;
559 | r_args FILTER filter {
561 if ($$->filter != FILTER_ACCEPT) cf_error("Filter specified twice");
564 | r_args where_filter {
566 if ($$->filter != FILTER_ACCEPT) cf_error("Filter specified twice");
575 $$->primary_only = 1;
581 | r_args export_mode SYM {
582 struct proto_config *c = (struct proto_config *) $3->def;
584 if ($$->export_mode) cf_error("Export specified twice");
585 if ($3->class != SYM_PROTO || !c->proto) cf_error("%s is not a protocol", $3->name);
586 $$->export_mode = $2;
587 $$->export_protocol = c->proto;
588 $$->running_on_config = c->proto->cf->global;
589 $$->tables_defined_by = RSD_TDB_INDIRECT;
591 | r_args export_mode SYM '.' r_args_channel {
592 struct proto_config *c = (struct proto_config *) $3->def;
594 if ($$->export_mode) cf_error("Export specified twice");
595 if ($3->class != SYM_PROTO || !c->proto) cf_error("%s is not a protocol", $3->name);
596 $$->export_mode = $2;
597 $$->export_channel = proto_find_channel_by_name(c->proto, $5);
598 if (!$$->export_channel) cf_error("Export channel not found");
599 $$->running_on_config = c->proto->cf->global;
600 $$->tables_defined_by = RSD_TDB_INDIRECT;
602 | r_args PROTOCOL SYM {
603 struct proto_config *c = (struct proto_config *) $3->def;
605 if ($$->show_protocol) cf_error("Protocol specified twice");
606 if ($3->class != SYM_PROTO || !c->proto) cf_error("%s is not a protocol", $3->name);
607 $$->show_protocol = c->proto;
608 $$->running_on_config = c->proto->cf->global;
609 $$->tables_defined_by = RSD_TDB_INDIRECT;
623 $$ = cfg_alloc($1.length);
629 $$ = cfg_alloc(sizeof(net_addr_vpn4));
630 net_fill_vpn4($$, $2, IP4_MAX_PREFIX_LENGTH, $1);
633 $$ = cfg_alloc(sizeof(net_addr_vpn6));
634 net_fill_vpn6($$, $2, IP6_MAX_PREFIX_LENGTH, $1);
637 if ($1->class == (SYM_CONSTANT | T_IP))
639 $$ = cfg_alloc(ipa_is_ip4(SYM_VAL($1).ip) ? sizeof(net_addr_ip4) : sizeof(net_addr_ip6));
640 net_fill_ip_host($$, SYM_VAL($1).ip);
642 else if (($1->class == (SYM_CONSTANT | T_NET)) && net_type_match(SYM_VAL($1).net, NB_IP | NB_VPN))
643 $$ = (net_addr *) SYM_VAL($1).net; /* Avoid const warning */
645 cf_error("IP address or network expected");
652 | IP4 { net_fill_ip4(&($$), $1, IP4_MAX_PREFIX_LENGTH); }
653 | IP6 { net_fill_ip6(&($$), $1, IP6_MAX_PREFIX_LENGTH); }
656 PREEXPORT { $$ = RSEM_PREEXPORT; }
657 | EXPORT { $$ = RSEM_EXPORT; }
658 | NOEXPORT { $$ = RSEM_NOEXPORT; }
661 /* This is ugly hack */
663 IPV4 { $$ = "ipv4"; }
664 | IPV4_MC { $$ = "ipv4-mc"; }
665 | IPV4_MPLS { $$ = "ipv4-mpls"; }
666 | IPV6 { $$ = "ipv6"; }
667 | IPV6_MC { $$ = "ipv6-mc"; }
668 | IPV6_MPLS { $$ = "ipv6-mpls"; }
669 | VPN4 { $$ = "vpn4"; }
670 | VPN4_MC { $$ = "vpn4-mc"; }
671 | VPN4_MPLS { $$ = "vpn4-mpls"; }
672 | VPN6 { $$ = "vpn6"; }
673 | VPN6_MC { $$ = "vpn6-mc"; }
674 | VPN6_MPLS { $$ = "vpn6-mpls"; }
675 | ROA4 { $$ = "roa4"; }
676 | ROA6 { $$ = "roa6"; }
677 | FLOW4 { $$ = "flow4"; }
678 | FLOW6 { $$ = "flow6"; }
679 | MPLS { $$ = "mpls"; }
680 | PRI { $$ = "pri"; }
681 | SEC { $$ = "sec"; }
684 CF_CLI_HELP(SHOW SYMBOLS, ..., [[Show all known symbolic names]])
685 CF_CLI(SHOW SYMBOLS, sym_args, [table|filter|function|protocol|template|<symbol>], [[Show all known symbolic names]])
686 { cmd_show_symbols($3); } ;
690 $$ = cfg_allocz(sizeof(struct sym_show_data));
692 | sym_args TABLE { $$ = $1; $$->type = SYM_TABLE; }
693 | sym_args FUNCTION { $$ = $1; $$->type = SYM_FUNCTION; }
694 | sym_args FILTER { $$ = $1; $$->type = SYM_FILTER; }
695 | sym_args PROTOCOL { $$ = $1; $$->type = SYM_PROTO; }
696 | sym_args TEMPLATE { $$ = $1; $$->type = SYM_TEMPLATE; }
697 | sym_args SYM { $$ = $1; $$->sym = $2; }
701 CF_CLI_HELP(DUMP, ..., [[Dump debugging information]])
702 CF_CLI(DUMP RESOURCES,,, [[Dump all allocated resource]])
703 { rdump(&root_pool); cli_msg(0, ""); } ;
704 CF_CLI(DUMP SOCKETS,,, [[Dump open sockets]])
705 { sk_dump_all(); cli_msg(0, ""); } ;
706 CF_CLI(DUMP EVENTS,,, [[Dump event log]])
707 { io_log_dump(); cli_msg(0, ""); } ;
708 CF_CLI(DUMP INTERFACES,,, [[Dump interface information]])
709 { if_dump_all(); cli_msg(0, ""); } ;
710 CF_CLI(DUMP NEIGHBORS,,, [[Dump neighbor cache]])
711 { neigh_dump_all(); cli_msg(0, ""); } ;
712 CF_CLI(DUMP ATTRIBUTES,,, [[Dump attribute cache]])
713 { rta_dump_all(); cli_msg(0, ""); } ;
714 CF_CLI(DUMP ROUTES,,, [[Dump routing table]])
715 { rt_dump_all(); cli_msg(0, ""); } ;
716 CF_CLI(DUMP PROTOCOLS,,, [[Dump protocol information]])
717 { protos_dump_all(); cli_msg(0, ""); } ;
719 CF_CLI(EVAL, term, <expr>, [[Evaluate an expression]])
722 CF_CLI_HELP(ECHO, ..., [[Control echoing of log messages]])
723 CF_CLI(ECHO, echo_mask echo_size, (all | off | { debug|trace|info|remote|warning|error|auth [, ...] }) [<buffer-size>], [[Control echoing of log messages]]) {
724 cli_set_log_echo(this_cli, $2, $3);
731 | '{' log_mask_list '}' { $$ = $2; }
735 /* empty */ { $$ = 4096; }
737 if ($1 < 256 || $1 > 65536) cf_error("Invalid log buffer size");
742 CF_CLI(DISABLE, proto_patt opttext, (<protocol> | \"<pattern>\" | all) [message], [[Disable protocol]])
743 { proto_apply_cmd($2, proto_cmd_disable, 1, (uintptr_t) $3); } ;
744 CF_CLI(ENABLE, proto_patt opttext, (<protocol> | \"<pattern>\" | all) [message], [[Enable protocol]])
745 { proto_apply_cmd($2, proto_cmd_enable, 1, (uintptr_t) $3); } ;
746 CF_CLI(RESTART, proto_patt opttext, (<protocol> | \"<pattern>\" | all) [message], [[Restart protocol]])
747 { proto_apply_cmd($2, proto_cmd_restart, 1, (uintptr_t) $3); } ;
748 CF_CLI(RELOAD, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protocol]])
749 { proto_apply_cmd($2, proto_cmd_reload, 1, CMD_RELOAD); } ;
750 CF_CLI(RELOAD IN, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protocol (just imported routes)]])
751 { proto_apply_cmd($3, proto_cmd_reload, 1, CMD_RELOAD_IN); } ;
752 CF_CLI(RELOAD OUT, proto_patt, <protocol> | \"<pattern>\" | all, [[Reload protocol (just exported routes)]])
753 { proto_apply_cmd($3, proto_cmd_reload, 1, CMD_RELOAD_OUT); } ;
755 CF_CLI_HELP(DEBUG, ..., [[Control protocol debugging via BIRD logs]])
756 CF_CLI(DEBUG, proto_patt debug_mask, (<protocol> | \"<pattern>\" | all) (all | off | { states|routes|filters|interfaces|events|packets [, ...] }), [[Control protocol debugging via BIRD logs]])
757 { proto_apply_cmd($2, proto_cmd_debug, 1, $3); } ;
759 CF_CLI_HELP(MRTDUMP, ..., [[Control protocol debugging via MRTdump files]])
760 CF_CLI(MRTDUMP, proto_patt mrtdump_mask, (<protocol> | \"<pattern>\" | all) (all | off | { states|messages [, ...] }), [[Control protocol debugging via MRTdump format]])
761 { proto_apply_cmd($2, proto_cmd_mrtdump, 1, $3); } ;
763 CF_CLI(RESTRICT,,,[[Restrict current CLI session to safe commands]])
764 { this_cli->restricted = 1; cli_msg(16, "Access restricted"); } ;
767 SYM { $$.ptr = $1; $$.patt = 0; }
768 | ALL { $$.ptr = NULL; $$.patt = 1; }
769 | TEXT { $$.ptr = $1; $$.patt = 1; }
773 SYM { $$.ptr = $1; $$.patt = 0; }
774 | { $$.ptr = NULL; $$.patt = 1; }
775 | TEXT { $$.ptr = $1; $$.patt = 1; }
778 CF_ADDTO(dynamic_attr, IGP_METRIC
779 { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_GEN_IGP_METRIC); })