0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Config: Dropping CF_ADDTO.

This commit is contained in:
Jan Maria Matejka 2018-06-26 14:29:03 +02:00
parent 1771f70d74
commit f851f0d7e3
17 changed files with 99 additions and 115 deletions

View File

@ -113,12 +113,13 @@ conf_entries:
| conf_entries conf | conf_entries conf
; ;
CF_ADDTO(conf, ';') conf: ';' ;
/* Constant expressions */ /* Constant expressions */
CF_ADDTO(conf, definition) conf: definition ;
definition: definition:
DEFINE SYM '=' term ';' { DEFINE SYM '=' term ';' {
struct f_val *val = cfg_alloc(sizeof(struct f_val)); struct f_val *val = cfg_alloc(sizeof(struct f_val));

View File

@ -34,15 +34,10 @@ m4_define(CF_keywd, `m4_ifdef([[CF_tok_$1]],,[[m4_define([[CF_tok_$1]],1)m4_defi
m4_define(CF_KEYWORDS, `m4_define([[CF_toks]],[[]])CF_iterate([[CF_keywd]], [[$@]])m4_ifelse(CF_toks,,,%token[[]]CF_toks m4_define(CF_KEYWORDS, `m4_define([[CF_toks]],[[]])CF_iterate([[CF_keywd]], [[$@]])m4_ifelse(CF_toks,,,%token[[]]CF_toks
)DNL') )DNL')
# Dynamic syntax rules
m4_define(CF_dyn_rules,)
m4_define(CF_ADDTO, `m4_define([[CF_rule_$1]],m4_ifdef([[CF_rule_$1]],CF_rule_$1 | ,[[m4_define([[CF_dyn_rules]],CF_dyn_rules[[CF_RULE($1)
]])]])$2)DNL')
# CLI commands # CLI commands
m4_define(CF_CLI, `m4_define([[CF_cmd]], cmd_[[]]m4_translit($1, [[ ]], _))DNL m4_define(CF_CLI, `m4_define([[CF_cmd]], cmd_[[]]m4_translit($1, [[ ]], _))DNL
m4_divert(2)CF_KEYWORDS(m4_translit($1, [[ ]], [[,]])) m4_divert(2)CF_KEYWORDS(m4_translit($1, [[ ]], [[,]]))
m4_divert(3)CF_ADDTO(cli_cmd, CF_cmd) m4_divert(3)cli_cmd: CF_cmd
CF_cmd: $1 $2 END') CF_cmd: $1 $2 END')
m4_define(CF_CLI_CMD, `') m4_define(CF_CLI_CMD, `')
m4_define(CF_CLI_HELP, `') m4_define(CF_CLI_HELP, `')
@ -62,10 +57,6 @@ m4_undivert(2)DNL
%% %%
m4_undivert(3)DNL m4_undivert(3)DNL
/* Dynamic rules */
m4_define(CF_RULE, [[$1: CF_rule_$1 ;]])
CF_dyn_rules
%% %%
m4_undivert(4)DNL m4_undivert(4)DNL
') ')

View File

@ -438,7 +438,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(conf, filter_def) conf: filter_def ;
filter_def: filter_def:
FILTER SYM { $2 = cf_define_symbol($2, SYM_FILTER, NULL); cf_push_scope( $2 ); } FILTER SYM { $2 = cf_define_symbol($2, SYM_FILTER, NULL); cf_push_scope( $2 ); }
filter_body { filter_body {
@ -449,12 +449,12 @@ filter_def:
} }
; ;
CF_ADDTO(conf, filter_eval) conf: filter_eval ;
filter_eval: filter_eval:
EVAL term { f_eval_int($2); } EVAL term { f_eval_int($2); }
; ;
CF_ADDTO(conf, bt_test_suite) conf: bt_test_suite ;
bt_test_suite: bt_test_suite:
BT_TEST_SUITE '(' SYM ',' text ')' { BT_TEST_SUITE '(' SYM ',' text ')' {
if (!($3->class & SYM_FUNCTION)) if (!($3->class & SYM_FUNCTION))
@ -588,7 +588,7 @@ function_body:
} }
; ;
CF_ADDTO(conf, function_def) conf: function_def ;
function_def: function_def:
FUNCTION SYM { DBG( "Beginning of function %s\n", $2->name ); FUNCTION SYM { DBG( "Beginning of function %s\n", $2->name );
$2 = cf_define_symbol($2, SYM_FUNCTION, NULL); $2 = cf_define_symbol($2, SYM_FUNCTION, NULL);
@ -804,13 +804,6 @@ constructor:
; ;
/*
* Maybe there are no dynamic attributes defined by protocols.
* For such cases, we force the dynamic_attr list to contain
* at least an invalid token, so it is syntantically correct.
*/
CF_ADDTO(dynamic_attr, INVALID_TOKEN { $$ = (struct f_dynamic_attr) {}; })
rtadot: /* EMPTY, we are not permitted RTA. prefix */ rtadot: /* EMPTY, we are not permitted RTA. prefix */
; ;

View File

@ -103,7 +103,7 @@ CF_GRAMMAR
/* Setting of router ID */ /* Setting of router ID */
CF_ADDTO(conf, rtrid) conf: rtrid ;
rtrid: rtrid:
ROUTER ID idval ';' { new_config->router_id = $3; } ROUTER ID idval ';' { new_config->router_id = $3; }
@ -124,7 +124,7 @@ idval:
} }
; ;
CF_ADDTO(conf, gr_opts) conf: gr_opts ;
gr_opts: GRACEFUL RESTART WAIT expr ';' { new_config->gr_wait = $4; } ; gr_opts: GRACEFUL RESTART WAIT expr ';' { new_config->gr_wait = $4; } ;
@ -149,7 +149,7 @@ CF_ENUM(T_ENUM_NETTYPE, NET_, IP4, IP6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6, IP
/* Creation of routing tables */ /* Creation of routing tables */
CF_ADDTO(conf, table) conf: table ;
table_sorted: table_sorted:
{ $$ = 0; } { $$ = 0; }
@ -166,7 +166,7 @@ table: net_type TABLE SYM table_sorted {
/* Definition of protocols */ /* Definition of protocols */
CF_ADDTO(conf, proto { proto_postconfig(); }) conf: proto { proto_postconfig(); } ;
proto_start: proto_start:
PROTOCOL { $$ = SYM_PROTO; } PROTOCOL { $$ = SYM_PROTO; }
@ -282,7 +282,7 @@ limit_spec:
; ;
CF_ADDTO(conf, debug_default) conf: debug_default ;
debug_default: debug_default:
DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; } DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; }
@ -291,7 +291,7 @@ debug_default:
/* MRTDUMP PROTOCOLS is in systep/unix/config.Y */ /* MRTDUMP PROTOCOLS is in systep/unix/config.Y */
CF_ADDTO(conf, timeformat_base) conf: timeformat_base ;
timeformat_which: timeformat_which:
ROUTE { $$ = &new_config->tf_route; } ROUTE { $$ = &new_config->tf_route; }
@ -367,7 +367,7 @@ tos:
/* Direct device route protocol */ /* Direct device route protocol */
CF_ADDTO(proto, dev_proto '}') proto: dev_proto '}' ;
dev_proto_start: proto_start DIRECT { dev_proto_start: proto_start DIRECT {
this_proto = proto_config_new(&proto_device, $1); this_proto = proto_config_new(&proto_device, $1);
@ -782,8 +782,7 @@ proto_patt2:
| TEXT { $$.ptr = $1; $$.patt = 1; } | TEXT { $$.ptr = $1; $$.patt = 1; }
; ;
CF_ADDTO(dynamic_attr, IGP_METRIC dynamic_attr: IGP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_GEN_IGP_METRIC); } ;
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_GEN_IGP_METRIC); })
CF_CODE CF_CODE

View File

@ -29,7 +29,7 @@ CF_KEYWORDS(BABEL, INTERFACE, METRIC, RXCOST, HELLO, UPDATE, INTERVAL, PORT,
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(proto, babel_proto) proto: babel_proto ;
babel_proto_start: proto_start BABEL babel_proto_start: proto_start BABEL
{ {
@ -125,7 +125,7 @@ babel_iface_opt_list:
babel_iface: babel_iface:
babel_iface_start iface_patt_list_nopx babel_iface_opt_list babel_iface_finish; babel_iface_start iface_patt_list_nopx babel_iface_opt_list babel_iface_finish;
CF_ADDTO(dynamic_attr, BABEL_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_BABEL_METRIC); }) dynamic_attr: BABEL_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_BABEL_METRIC); } ;
CF_CLI_HELP(SHOW BABEL, ..., [[Show information about Babel protocol]]); CF_CLI_HELP(SHOW BABEL, ..., [[Show information about Babel protocol]]);

View File

@ -31,7 +31,7 @@ CF_KEYWORDS(BFD, MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, PASSIVE,
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(proto, bfd_proto) proto: bfd_proto ;
bfd_proto_start: proto_start BFD bfd_proto_start: proto_start BFD
{ {

View File

@ -40,7 +40,7 @@ CF_KEYWORDS(CEASE, PREFIX, LIMIT, HIT, ADMINISTRATIVE, SHUTDOWN, RESET, PEER,
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(proto, bgp_proto '}' ) proto: bgp_proto '}' ;
bgp_proto_start: proto_start BGP { bgp_proto_start: proto_start BGP {
this_proto = proto_config_new(&proto_bgp, $1); this_proto = proto_config_new(&proto_bgp, $1);
@ -252,30 +252,30 @@ bgp_channel_end:
bgp_proto_channel: bgp_channel_start bgp_channel_opt_list bgp_channel_end; bgp_proto_channel: bgp_channel_start bgp_channel_opt_list bgp_channel_end;
CF_ADDTO(dynamic_attr, BGP_ORIGIN dynamic_attr: BGP_ORIGIN
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_BGP_ORIGIN, EA_CODE(PROTOCOL_BGP, BA_ORIGIN)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_BGP_ORIGIN, EA_CODE(PROTOCOL_BGP, BA_ORIGIN)); } ;
CF_ADDTO(dynamic_attr, BGP_PATH dynamic_attr: BGP_PATH
{ $$ = f_new_dynamic_attr(EAF_TYPE_AS_PATH, T_PATH, EA_CODE(PROTOCOL_BGP, BA_AS_PATH)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_AS_PATH, T_PATH, EA_CODE(PROTOCOL_BGP, BA_AS_PATH)); } ;
CF_ADDTO(dynamic_attr, BGP_NEXT_HOP dynamic_attr: BGP_NEXT_HOP
{ $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_CODE(PROTOCOL_BGP, BA_NEXT_HOP)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_CODE(PROTOCOL_BGP, BA_NEXT_HOP)); } ;
CF_ADDTO(dynamic_attr, BGP_MED dynamic_attr: BGP_MED
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC)); } ;
CF_ADDTO(dynamic_attr, BGP_LOCAL_PREF dynamic_attr: BGP_LOCAL_PREF
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF)); } ;
CF_ADDTO(dynamic_attr, BGP_ATOMIC_AGGR dynamic_attr: BGP_ATOMIC_AGGR
{ $$ = f_new_dynamic_attr(EAF_TYPE_OPAQUE, T_ENUM_EMPTY, EA_CODE(PROTOCOL_BGP, BA_ATOMIC_AGGR)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_OPAQUE, T_ENUM_EMPTY, EA_CODE(PROTOCOL_BGP, BA_ATOMIC_AGGR)); } ;
CF_ADDTO(dynamic_attr, BGP_AGGREGATOR dynamic_attr: BGP_AGGREGATOR
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_AGGREGATOR)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_AGGREGATOR)); } ;
CF_ADDTO(dynamic_attr, BGP_COMMUNITY dynamic_attr: BGP_COMMUNITY
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); } ;
CF_ADDTO(dynamic_attr, BGP_ORIGINATOR_ID dynamic_attr: BGP_ORIGINATOR_ID
{ $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_CODE(PROTOCOL_BGP, BA_ORIGINATOR_ID)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_CODE(PROTOCOL_BGP, BA_ORIGINATOR_ID)); } ;
CF_ADDTO(dynamic_attr, BGP_CLUSTER_LIST dynamic_attr: BGP_CLUSTER_LIST
{ $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_CLUSTER_LIST)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_CLUSTER_LIST)); } ;
CF_ADDTO(dynamic_attr, BGP_EXT_COMMUNITY dynamic_attr: BGP_EXT_COMMUNITY
{ $$ = f_new_dynamic_attr(EAF_TYPE_EC_SET, T_ECLIST, EA_CODE(PROTOCOL_BGP, BA_EXT_COMMUNITY)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_EC_SET, T_ECLIST, EA_CODE(PROTOCOL_BGP, BA_EXT_COMMUNITY)); } ;
CF_ADDTO(dynamic_attr, BGP_LARGE_COMMUNITY dynamic_attr: BGP_LARGE_COMMUNITY
{ $$ = f_new_dynamic_attr(EAF_TYPE_LC_SET, T_LCLIST, EA_CODE(PROTOCOL_BGP, BA_LARGE_COMMUNITY)); }) { $$ = f_new_dynamic_attr(EAF_TYPE_LC_SET, T_LCLIST, EA_CODE(PROTOCOL_BGP, BA_LARGE_COMMUNITY)); } ;

View File

@ -207,7 +207,7 @@ CF_KEYWORDS(SECONDARY, MERGE, LSA, SUPPRESSION, MULTICAST, RFC5838)
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(proto, ospf_proto '}' { ospf_proto_finish(); } ) proto: ospf_proto '}' { ospf_proto_finish(); } ;
ospf_variant: ospf_variant:
OSPF { $$ = 1; } OSPF { $$ = 1; }
@ -497,10 +497,10 @@ ospf_iface:
ospf_iface_start ospf_iface_patt_list ospf_iface_opt_list { ospf_iface_finish(); } ospf_iface_start ospf_iface_patt_list ospf_iface_opt_list { ospf_iface_finish(); }
; ;
CF_ADDTO(dynamic_attr, OSPF_METRIC1 { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_METRIC1); }) dynamic_attr: OSPF_METRIC1 { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_METRIC1); } ;
CF_ADDTO(dynamic_attr, OSPF_METRIC2 { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_METRIC2); }) dynamic_attr: OSPF_METRIC2 { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_METRIC2); } ;
CF_ADDTO(dynamic_attr, OSPF_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_TAG); }) dynamic_attr: OSPF_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_TAG); } ;
CF_ADDTO(dynamic_attr, OSPF_ROUTER_ID { $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_OSPF_ROUTER_ID); }) dynamic_attr: OSPF_ROUTER_ID { $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_OSPF_ROUTER_ID); } ;
CF_CLI_HELP(SHOW OSPF, ..., [[Show information about OSPF protocol]]); CF_CLI_HELP(SHOW OSPF, ..., [[Show information about OSPF protocol]]);
CF_CLI(SHOW OSPF, optsym, [<name>], [[Show information about OSPF protocol]]) CF_CLI(SHOW OSPF, optsym, [<name>], [[Show information about OSPF protocol]])

View File

@ -20,7 +20,7 @@ CF_KEYWORDS(PIPE, PEER, TABLE)
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(proto, pipe_proto '}' { this_channel = NULL; } ) proto: pipe_proto '}' { this_channel = NULL; } ;
pipe_proto_start: proto_start PIPE pipe_proto_start: proto_start PIPE
{ {

View File

@ -39,7 +39,7 @@ CF_ENUM(T_ENUM_RA_PREFERENCE, RA_PREF_, LOW, MEDIUM, HIGH)
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(proto, radv_proto) proto: radv_proto ;
radv_proto_start: proto_start RADV radv_proto_start: proto_start RADV
{ {
@ -332,8 +332,8 @@ radv_sensitive:
| SENSITIVE bool { $$ = $2; } | SENSITIVE bool { $$ = $2; }
; ;
CF_ADDTO(dynamic_attr, RA_PREFERENCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_RA_PREFERENCE, EA_RA_PREFERENCE); }) dynamic_attr: RA_PREFERENCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_RA_PREFERENCE, EA_RA_PREFERENCE); } ;
CF_ADDTO(dynamic_attr, RA_LIFETIME { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RA_LIFETIME); }) dynamic_attr: RA_LIFETIME { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RA_LIFETIME); } ;
CF_CODE CF_CODE

View File

@ -42,7 +42,7 @@ CF_KEYWORDS(RIP, NG, ECMP, LIMIT, WEIGHT, INFINITY, METRIC, UPDATE, TIMEOUT,
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(proto, rip_proto) proto: rip_proto ;
rip_variant: rip_variant:
RIP { $$ = 1; } RIP { $$ = 1; }
@ -186,8 +186,8 @@ rip_iface:
rip_iface_start iface_patt_list_nopx rip_iface_opt_list rip_iface_finish; rip_iface_start iface_patt_list_nopx rip_iface_opt_list rip_iface_finish;
CF_ADDTO(dynamic_attr, RIP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RIP_METRIC); }) dynamic_attr: RIP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RIP_METRIC); } ;
CF_ADDTO(dynamic_attr, RIP_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RIP_TAG); }) dynamic_attr: RIP_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RIP_TAG); } ;
CF_CLI_HELP(SHOW RIP, ..., [[Show information about RIP protocol]]); CF_CLI_HELP(SHOW RIP, ..., [[Show information about RIP protocol]]);

View File

@ -38,7 +38,7 @@ CF_KEYWORDS(RPKI, REMOTE, BIRD, PRIVATE, PUBLIC, KEY, TCP, SSH, TRANSPORT, USER,
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(proto, rpki_proto) proto: rpki_proto ;
rpki_proto_start: proto_start RPKI { rpki_proto_start: proto_start RPKI {
this_proto = proto_config_new(&proto_rpki, $1); this_proto = proto_config_new(&proto_rpki, $1);

View File

@ -49,7 +49,7 @@ CF_KEYWORDS(ONLINK, WEIGHT, RECURSIVE, IGP, TABLE, BLACKHOLE, UNREACHABLE, BFD,
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(proto, static_proto '}') proto: static_proto '}' ;
static_proto_start: proto_start STATIC static_proto_start: proto_start STATIC
{ {

View File

@ -14,7 +14,7 @@ CF_KEYWORDS(KERNEL, TABLE)
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(kern_proto, kern_proto kern_sys_item ';') kern_proto: kern_proto kern_sys_item ';' ;
kern_sys_item: kern_sys_item:
KERNEL TABLE expr { KERNEL TABLE expr {

View File

@ -19,44 +19,44 @@ CF_KEYWORDS(KERNEL, TABLE, METRIC, KRT_PREFSRC, KRT_REALM, KRT_SCOPE, KRT_MTU, K
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(kern_proto, kern_proto kern_sys_item ';') kern_proto: kern_proto kern_sys_item ';' ;
kern_sys_item: kern_sys_item:
KERNEL TABLE expr { THIS_KRT->sys.table_id = $3; } KERNEL TABLE expr { THIS_KRT->sys.table_id = $3; }
| METRIC expr { THIS_KRT->sys.metric = $2; } | METRIC expr { THIS_KRT->sys.metric = $2; }
; ;
CF_ADDTO(dynamic_attr, KRT_PREFSRC { $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_KRT_PREFSRC); }) dynamic_attr: KRT_PREFSRC { $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_KRT_PREFSRC); } ;
CF_ADDTO(dynamic_attr, KRT_REALM { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_REALM); }) dynamic_attr: KRT_REALM { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_REALM); } ;
CF_ADDTO(dynamic_attr, KRT_SCOPE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_SCOPE); }) dynamic_attr: KRT_SCOPE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_SCOPE); } ;
CF_ADDTO(dynamic_attr, KRT_MTU { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_MTU); }) dynamic_attr: KRT_MTU { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_MTU); } ;
CF_ADDTO(dynamic_attr, KRT_WINDOW { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_WINDOW); }) dynamic_attr: KRT_WINDOW { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_WINDOW); } ;
CF_ADDTO(dynamic_attr, KRT_RTT { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_RTT); }) dynamic_attr: KRT_RTT { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_RTT); } ;
CF_ADDTO(dynamic_attr, KRT_RTTVAR { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_RTTVAR); }) dynamic_attr: KRT_RTTVAR { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_RTTVAR); } ;
CF_ADDTO(dynamic_attr, KRT_SSTRESH { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_SSTRESH); }) dynamic_attr: KRT_SSTRESH { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_SSTRESH); } ;
CF_ADDTO(dynamic_attr, KRT_CWND { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_CWND); }) dynamic_attr: KRT_CWND { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_CWND); } ;
CF_ADDTO(dynamic_attr, KRT_ADVMSS { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_ADVMSS); }) dynamic_attr: KRT_ADVMSS { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_ADVMSS); } ;
CF_ADDTO(dynamic_attr, KRT_REORDERING { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_REORDERING); }) dynamic_attr: KRT_REORDERING { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_REORDERING); } ;
CF_ADDTO(dynamic_attr, KRT_HOPLIMIT { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_HOPLIMIT); }) dynamic_attr: KRT_HOPLIMIT { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_HOPLIMIT); } ;
CF_ADDTO(dynamic_attr, KRT_INITCWND { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_INITCWND); }) dynamic_attr: KRT_INITCWND { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_INITCWND); } ;
CF_ADDTO(dynamic_attr, KRT_RTO_MIN { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_RTO_MIN); }) dynamic_attr: KRT_RTO_MIN { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_RTO_MIN); } ;
CF_ADDTO(dynamic_attr, KRT_INITRWND { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_INITRWND); }) dynamic_attr: KRT_INITRWND { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_INITRWND); } ;
CF_ADDTO(dynamic_attr, KRT_QUICKACK { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_QUICKACK); }) dynamic_attr: KRT_QUICKACK { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_QUICKACK); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_MTU { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_MTU); }) dynamic_attr: KRT_LOCK_MTU { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_MTU); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_WINDOW { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_WINDOW); }) dynamic_attr: KRT_LOCK_WINDOW { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_WINDOW); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_RTT { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_RTT); }) dynamic_attr: KRT_LOCK_RTT { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_RTT); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_RTTVAR { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_RTTVAR); }) dynamic_attr: KRT_LOCK_RTTVAR { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_RTTVAR); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_SSTRESH { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_SSTHRESH); }) dynamic_attr: KRT_LOCK_SSTRESH { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_SSTHRESH); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_CWND { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_CWND); }) dynamic_attr: KRT_LOCK_CWND { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_CWND); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_ADVMSS { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_ADVMSS); }) dynamic_attr: KRT_LOCK_ADVMSS { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_ADVMSS); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_REORDERING { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_REORDERING); }) dynamic_attr: KRT_LOCK_REORDERING { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_REORDERING); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_HOPLIMIT { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_HOPLIMIT); }) dynamic_attr: KRT_LOCK_HOPLIMIT { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_HOPLIMIT); } ;
CF_ADDTO(dynamic_attr, KRT_LOCK_RTO_MIN { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_RTO_MIN); }) dynamic_attr: KRT_LOCK_RTO_MIN { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_RTO_MIN); } ;
CF_ADDTO(dynamic_attr, KRT_FEATURE_ECN { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_FEATURE_ECN); }) dynamic_attr: KRT_FEATURE_ECN { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_FEATURE_ECN); } ;
CF_ADDTO(dynamic_attr, KRT_FEATURE_ALLFRAG { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_FEATURE_ALLFRAG); }) dynamic_attr: KRT_FEATURE_ALLFRAG { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_FEATURE_ALLFRAG); } ;
CF_CODE CF_CODE

View File

@ -24,7 +24,7 @@ CF_KEYWORDS(NAME, CONFIRM, UNDO, CHECK, TIMEOUT, DEBUG, LATENCY, LIMIT, WATCHDOG
CF_GRAMMAR CF_GRAMMAR
CF_ADDTO(conf, log_config) conf: log_config ;
log_config: LOG log_file log_mask ';' { log_config: LOG log_file log_mask ';' {
struct log_config *c = cfg_allocz(sizeof(struct log_config)); struct log_config *c = cfg_allocz(sizeof(struct log_config));
@ -72,7 +72,7 @@ log_cat:
; ;
CF_ADDTO(conf, mrtdump_base) conf: mrtdump_base ;
mrtdump_base: mrtdump_base:
MRTDUMP PROTOCOLS mrtdump_mask ';' { new_config->proto_default_mrtdump = $3; } MRTDUMP PROTOCOLS mrtdump_mask ';' { new_config->proto_default_mrtdump = $3; }
@ -84,7 +84,7 @@ mrtdump_base:
; ;
CF_ADDTO(conf, debug_unix) conf: debug_unix ;
debug_unix: debug_unix:
DEBUG LATENCY bool { new_config->latency_debug = $3; } DEBUG LATENCY bool { new_config->latency_debug = $3; }

View File

@ -38,15 +38,15 @@ CF_GRAMMAR
/* Kernel syncer protocol */ /* Kernel syncer protocol */
CF_ADDTO(proto, kern_proto '}') proto: kern_proto '}' ;
kern_proto_start: proto_start KERNEL { kern_proto_start: proto_start KERNEL {
this_proto = krt_init_config($1); this_proto = krt_init_config($1);
} }
; ;
CF_ADDTO(kern_proto, kern_proto_start proto_name '{') kern_proto: kern_proto_start proto_name '{' ;
CF_ADDTO(kern_proto, kern_proto kern_item ';') kern_proto: kern_proto kern_item ';' ;
kern_mp_limit: kern_mp_limit:
/* empty */ { $$ = KRT_DEFAULT_ECMP_LIMIT; } /* empty */ { $$ = KRT_DEFAULT_ECMP_LIMIT; }
@ -80,13 +80,13 @@ kern_item:
/* Kernel interface protocol */ /* Kernel interface protocol */
CF_ADDTO(proto, kif_proto '}') proto: kif_proto '}' ;
kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); } kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); }
; ;
CF_ADDTO(kif_proto, kif_proto_start proto_name '{') kif_proto: kif_proto_start proto_name '{' ;
CF_ADDTO(kif_proto, kif_proto kif_item ';') kif_proto: kif_proto kif_item ';' ;
kif_item: kif_item:
proto_item proto_item
@ -122,8 +122,8 @@ kif_iface:
kif_iface_start iface_patt_list_nopx kif_iface_opt_list; kif_iface_start iface_patt_list_nopx kif_iface_opt_list;
CF_ADDTO(dynamic_attr, KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_SOURCE); }) dynamic_attr: KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_SOURCE); } ;
CF_ADDTO(dynamic_attr, KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_METRIC); }) dynamic_attr: KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_METRIC); } ;
CF_CODE CF_CODE