diff --git a/conf/confbase.Y b/conf/confbase.Y index 72f56f1e..8fd72e5e 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -113,12 +113,13 @@ conf_entries: | conf_entries conf ; -CF_ADDTO(conf, ';') +conf: ';' ; /* Constant expressions */ -CF_ADDTO(conf, definition) +conf: definition ; + definition: DEFINE SYM '=' term ';' { struct f_val *val = cfg_alloc(sizeof(struct f_val)); diff --git a/conf/gen_parser.m4 b/conf/gen_parser.m4 index 00b55023..af43d96f 100644 --- a/conf/gen_parser.m4 +++ b/conf/gen_parser.m4 @@ -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 )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 m4_define(CF_CLI, `m4_define([[CF_cmd]], cmd_[[]]m4_translit($1, [[ ]], _))DNL 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') m4_define(CF_CLI_CMD, `') m4_define(CF_CLI_HELP, `') @@ -62,10 +57,6 @@ m4_undivert(2)DNL %% m4_undivert(3)DNL -/* Dynamic rules */ - -m4_define(CF_RULE, [[$1: CF_rule_$1 ;]]) -CF_dyn_rules %% m4_undivert(4)DNL ') diff --git a/filter/config.Y b/filter/config.Y index cf499b66..bbb8a640 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -438,7 +438,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN, CF_GRAMMAR -CF_ADDTO(conf, filter_def) +conf: filter_def ; filter_def: FILTER SYM { $2 = cf_define_symbol($2, SYM_FILTER, NULL); cf_push_scope( $2 ); } filter_body { @@ -449,12 +449,12 @@ filter_def: } ; -CF_ADDTO(conf, filter_eval) +conf: filter_eval ; filter_eval: EVAL term { f_eval_int($2); } ; -CF_ADDTO(conf, bt_test_suite) +conf: bt_test_suite ; bt_test_suite: BT_TEST_SUITE '(' SYM ',' text ')' { if (!($3->class & SYM_FUNCTION)) @@ -588,7 +588,7 @@ function_body: } ; -CF_ADDTO(conf, function_def) +conf: function_def ; function_def: FUNCTION SYM { DBG( "Beginning of function %s\n", $2->name ); $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 */ ; diff --git a/nest/config.Y b/nest/config.Y index ab09a10c..88f74b96 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -103,7 +103,7 @@ CF_GRAMMAR /* Setting of router ID */ -CF_ADDTO(conf, rtrid) +conf: rtrid ; rtrid: 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; } ; @@ -149,7 +149,7 @@ CF_ENUM(T_ENUM_NETTYPE, NET_, IP4, IP6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6, IP /* Creation of routing tables */ -CF_ADDTO(conf, table) +conf: table ; table_sorted: { $$ = 0; } @@ -166,7 +166,7 @@ table: net_type TABLE SYM table_sorted { /* Definition of protocols */ -CF_ADDTO(conf, proto { proto_postconfig(); }) +conf: proto { proto_postconfig(); } ; proto_start: PROTOCOL { $$ = SYM_PROTO; } @@ -282,7 +282,7 @@ limit_spec: ; -CF_ADDTO(conf, debug_default) +conf: debug_default ; debug_default: DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; } @@ -291,7 +291,7 @@ debug_default: /* MRTDUMP PROTOCOLS is in systep/unix/config.Y */ -CF_ADDTO(conf, timeformat_base) +conf: timeformat_base ; timeformat_which: ROUTE { $$ = &new_config->tf_route; } @@ -367,7 +367,7 @@ tos: /* Direct device route protocol */ -CF_ADDTO(proto, dev_proto '}') +proto: dev_proto '}' ; dev_proto_start: proto_start DIRECT { this_proto = proto_config_new(&proto_device, $1); @@ -782,8 +782,7 @@ proto_patt2: | TEXT { $$.ptr = $1; $$.patt = 1; } ; -CF_ADDTO(dynamic_attr, IGP_METRIC - { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_GEN_IGP_METRIC); }) +dynamic_attr: IGP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_GEN_IGP_METRIC); } ; CF_CODE diff --git a/proto/babel/config.Y b/proto/babel/config.Y index 2b20c43f..3af79fd6 100644 --- a/proto/babel/config.Y +++ b/proto/babel/config.Y @@ -29,7 +29,7 @@ CF_KEYWORDS(BABEL, INTERFACE, METRIC, RXCOST, HELLO, UPDATE, INTERVAL, PORT, CF_GRAMMAR -CF_ADDTO(proto, babel_proto) +proto: babel_proto ; babel_proto_start: proto_start BABEL { @@ -125,7 +125,7 @@ babel_iface_opt_list: babel_iface: 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]]); diff --git a/proto/bfd/config.Y b/proto/bfd/config.Y index 73414362..3f5714fd 100644 --- a/proto/bfd/config.Y +++ b/proto/bfd/config.Y @@ -31,7 +31,7 @@ CF_KEYWORDS(BFD, MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, PASSIVE, CF_GRAMMAR -CF_ADDTO(proto, bfd_proto) +proto: bfd_proto ; bfd_proto_start: proto_start BFD { diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y index c731c4c7..7583f7d1 100644 --- a/proto/bgp/config.Y +++ b/proto/bgp/config.Y @@ -40,7 +40,7 @@ CF_KEYWORDS(CEASE, PREFIX, LIMIT, HIT, ADMINISTRATIVE, SHUTDOWN, RESET, PEER, CF_GRAMMAR -CF_ADDTO(proto, bgp_proto '}' ) +proto: bgp_proto '}' ; bgp_proto_start: proto_start BGP { 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; -CF_ADDTO(dynamic_attr, BGP_ORIGIN - { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_BGP_ORIGIN, EA_CODE(PROTOCOL_BGP, BA_ORIGIN)); }) -CF_ADDTO(dynamic_attr, BGP_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 - { $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_CODE(PROTOCOL_BGP, BA_NEXT_HOP)); }) -CF_ADDTO(dynamic_attr, BGP_MED - { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC)); }) -CF_ADDTO(dynamic_attr, BGP_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 - { $$ = f_new_dynamic_attr(EAF_TYPE_OPAQUE, T_ENUM_EMPTY, EA_CODE(PROTOCOL_BGP, BA_ATOMIC_AGGR)); }) -CF_ADDTO(dynamic_attr, BGP_AGGREGATOR - { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_AGGREGATOR)); }) -CF_ADDTO(dynamic_attr, BGP_COMMUNITY - { $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); }) -CF_ADDTO(dynamic_attr, BGP_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 - { $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_CLUSTER_LIST)); }) -CF_ADDTO(dynamic_attr, BGP_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 - { $$ = f_new_dynamic_attr(EAF_TYPE_LC_SET, T_LCLIST, EA_CODE(PROTOCOL_BGP, BA_LARGE_COMMUNITY)); }) +dynamic_attr: BGP_ORIGIN + { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_BGP_ORIGIN, EA_CODE(PROTOCOL_BGP, BA_ORIGIN)); } ; +dynamic_attr: BGP_PATH + { $$ = f_new_dynamic_attr(EAF_TYPE_AS_PATH, T_PATH, EA_CODE(PROTOCOL_BGP, BA_AS_PATH)); } ; +dynamic_attr: BGP_NEXT_HOP + { $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_CODE(PROTOCOL_BGP, BA_NEXT_HOP)); } ; +dynamic_attr: BGP_MED + { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_MULTI_EXIT_DISC)); } ; +dynamic_attr: BGP_LOCAL_PREF + { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_LOCAL_PREF)); } ; +dynamic_attr: BGP_ATOMIC_AGGR + { $$ = f_new_dynamic_attr(EAF_TYPE_OPAQUE, T_ENUM_EMPTY, EA_CODE(PROTOCOL_BGP, BA_ATOMIC_AGGR)); } ; +dynamic_attr: BGP_AGGREGATOR + { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_CODE(PROTOCOL_BGP, BA_AGGREGATOR)); } ; +dynamic_attr: BGP_COMMUNITY + { $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); } ; +dynamic_attr: BGP_ORIGINATOR_ID + { $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_CODE(PROTOCOL_BGP, BA_ORIGINATOR_ID)); } ; +dynamic_attr: BGP_CLUSTER_LIST + { $$ = f_new_dynamic_attr(EAF_TYPE_INT_SET, T_CLIST, EA_CODE(PROTOCOL_BGP, BA_CLUSTER_LIST)); } ; +dynamic_attr: BGP_EXT_COMMUNITY + { $$ = f_new_dynamic_attr(EAF_TYPE_EC_SET, T_ECLIST, EA_CODE(PROTOCOL_BGP, BA_EXT_COMMUNITY)); } ; +dynamic_attr: BGP_LARGE_COMMUNITY + { $$ = f_new_dynamic_attr(EAF_TYPE_LC_SET, T_LCLIST, EA_CODE(PROTOCOL_BGP, BA_LARGE_COMMUNITY)); } ; diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y index c439a614..b89584e1 100644 --- a/proto/ospf/config.Y +++ b/proto/ospf/config.Y @@ -207,7 +207,7 @@ CF_KEYWORDS(SECONDARY, MERGE, LSA, SUPPRESSION, MULTICAST, RFC5838) CF_GRAMMAR -CF_ADDTO(proto, ospf_proto '}' { ospf_proto_finish(); } ) +proto: ospf_proto '}' { ospf_proto_finish(); } ; ospf_variant: OSPF { $$ = 1; } @@ -497,10 +497,10 @@ ospf_iface: 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); }) -CF_ADDTO(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); }) -CF_ADDTO(dynamic_attr, OSPF_ROUTER_ID { $$ = f_new_dynamic_attr(EAF_TYPE_ROUTER_ID, T_QUAD, EA_OSPF_ROUTER_ID); }) +dynamic_attr: OSPF_METRIC1 { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_METRIC1); } ; +dynamic_attr: OSPF_METRIC2 { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_METRIC2); } ; +dynamic_attr: OSPF_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_OSPF_TAG); } ; +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(SHOW OSPF, optsym, [], [[Show information about OSPF protocol]]) diff --git a/proto/pipe/config.Y b/proto/pipe/config.Y index b3c332be..18e1d0fc 100644 --- a/proto/pipe/config.Y +++ b/proto/pipe/config.Y @@ -20,7 +20,7 @@ CF_KEYWORDS(PIPE, PEER, TABLE) CF_GRAMMAR -CF_ADDTO(proto, pipe_proto '}' { this_channel = NULL; } ) +proto: pipe_proto '}' { this_channel = NULL; } ; pipe_proto_start: proto_start PIPE { diff --git a/proto/radv/config.Y b/proto/radv/config.Y index 37815f0d..53715f77 100644 --- a/proto/radv/config.Y +++ b/proto/radv/config.Y @@ -39,7 +39,7 @@ CF_ENUM(T_ENUM_RA_PREFERENCE, RA_PREF_, LOW, MEDIUM, HIGH) CF_GRAMMAR -CF_ADDTO(proto, radv_proto) +proto: radv_proto ; radv_proto_start: proto_start RADV { @@ -332,8 +332,8 @@ radv_sensitive: | SENSITIVE bool { $$ = $2; } ; -CF_ADDTO(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_PREFERENCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_ENUM_RA_PREFERENCE, EA_RA_PREFERENCE); } ; +dynamic_attr: RA_LIFETIME { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RA_LIFETIME); } ; CF_CODE diff --git a/proto/rip/config.Y b/proto/rip/config.Y index c46cf00c..172299d0 100644 --- a/proto/rip/config.Y +++ b/proto/rip/config.Y @@ -42,7 +42,7 @@ CF_KEYWORDS(RIP, NG, ECMP, LIMIT, WEIGHT, INFINITY, METRIC, UPDATE, TIMEOUT, CF_GRAMMAR -CF_ADDTO(proto, rip_proto) +proto: rip_proto ; rip_variant: RIP { $$ = 1; } @@ -186,8 +186,8 @@ rip_iface: 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); }) -CF_ADDTO(dynamic_attr, RIP_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RIP_TAG); }) +dynamic_attr: RIP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_RIP_METRIC); } ; +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]]); diff --git a/proto/rpki/config.Y b/proto/rpki/config.Y index 39fdfd01..a88a29a1 100644 --- a/proto/rpki/config.Y +++ b/proto/rpki/config.Y @@ -38,7 +38,7 @@ CF_KEYWORDS(RPKI, REMOTE, BIRD, PRIVATE, PUBLIC, KEY, TCP, SSH, TRANSPORT, USER, CF_GRAMMAR -CF_ADDTO(proto, rpki_proto) +proto: rpki_proto ; rpki_proto_start: proto_start RPKI { this_proto = proto_config_new(&proto_rpki, $1); diff --git a/proto/static/config.Y b/proto/static/config.Y index 66e5ea4c..d7a02961 100644 --- a/proto/static/config.Y +++ b/proto/static/config.Y @@ -49,7 +49,7 @@ CF_KEYWORDS(ONLINK, WEIGHT, RECURSIVE, IGP, TABLE, BLACKHOLE, UNREACHABLE, BFD, CF_GRAMMAR -CF_ADDTO(proto, static_proto '}') +proto: static_proto '}' ; static_proto_start: proto_start STATIC { diff --git a/sysdep/bsd/krt-sock.Y b/sysdep/bsd/krt-sock.Y index 81422c79..8581bd43 100644 --- a/sysdep/bsd/krt-sock.Y +++ b/sysdep/bsd/krt-sock.Y @@ -14,7 +14,7 @@ CF_KEYWORDS(KERNEL, TABLE) CF_GRAMMAR -CF_ADDTO(kern_proto, kern_proto kern_sys_item ';') +kern_proto: kern_proto kern_sys_item ';' ; kern_sys_item: KERNEL TABLE expr { diff --git a/sysdep/linux/netlink.Y b/sysdep/linux/netlink.Y index f577244d..1030e5d4 100644 --- a/sysdep/linux/netlink.Y +++ b/sysdep/linux/netlink.Y @@ -19,44 +19,44 @@ CF_KEYWORDS(KERNEL, TABLE, METRIC, KRT_PREFSRC, KRT_REALM, KRT_SCOPE, KRT_MTU, K CF_GRAMMAR -CF_ADDTO(kern_proto, kern_proto kern_sys_item ';') +kern_proto: kern_proto kern_sys_item ';' ; kern_sys_item: KERNEL TABLE expr { THIS_KRT->sys.table_id = $3; } | 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); }) -CF_ADDTO(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_PREFSRC { $$ = f_new_dynamic_attr(EAF_TYPE_IP_ADDRESS, T_IP, EA_KRT_PREFSRC); } ; +dynamic_attr: KRT_REALM { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_REALM); } ; +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); }) -CF_ADDTO(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); }) -CF_ADDTO(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); }) -CF_ADDTO(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); }) -CF_ADDTO(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); }) -CF_ADDTO(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); }) -CF_ADDTO(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_MTU { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_MTU); } ; +dynamic_attr: KRT_WINDOW { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_WINDOW); } ; +dynamic_attr: KRT_RTT { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_RTT); } ; +dynamic_attr: KRT_RTTVAR { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_RTTVAR); } ; +dynamic_attr: KRT_SSTRESH { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_SSTRESH); } ; +dynamic_attr: KRT_CWND { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_CWND); } ; +dynamic_attr: KRT_ADVMSS { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_ADVMSS); } ; +dynamic_attr: KRT_REORDERING { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_REORDERING); } ; +dynamic_attr: KRT_HOPLIMIT { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_HOPLIMIT); } ; +dynamic_attr: KRT_INITCWND { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_INITCWND); } ; +dynamic_attr: KRT_RTO_MIN { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_RTO_MIN); } ; +dynamic_attr: KRT_INITRWND { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_INITRWND); } ; +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); }) -CF_ADDTO(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); }) -CF_ADDTO(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); }) -CF_ADDTO(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); }) -CF_ADDTO(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); }) -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_MTU { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_MTU); } ; +dynamic_attr: KRT_LOCK_WINDOW { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_WINDOW); } ; +dynamic_attr: KRT_LOCK_RTT { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_RTT); } ; +dynamic_attr: KRT_LOCK_RTTVAR { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_RTTVAR); } ; +dynamic_attr: KRT_LOCK_SSTRESH { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_SSTHRESH); } ; +dynamic_attr: KRT_LOCK_CWND { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_CWND); } ; +dynamic_attr: KRT_LOCK_ADVMSS { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_ADVMSS); } ; +dynamic_attr: KRT_LOCK_REORDERING { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_REORDERING); } ; +dynamic_attr: KRT_LOCK_HOPLIMIT { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_LOCK_HOPLIMIT); } ; +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); }) -CF_ADDTO(dynamic_attr, KRT_FEATURE_ALLFRAG { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_FEATURE_ALLFRAG); }) +dynamic_attr: KRT_FEATURE_ECN { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_FEATURE_ECN); } ; +dynamic_attr: KRT_FEATURE_ALLFRAG { $$ = f_new_dynamic_attr(EAF_TYPE_BITFIELD, T_BOOL, EA_KRT_FEATURE_ALLFRAG); } ; CF_CODE diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y index ccca4a62..1bffa322 100644 --- a/sysdep/unix/config.Y +++ b/sysdep/unix/config.Y @@ -24,7 +24,7 @@ CF_KEYWORDS(NAME, CONFIRM, UNDO, CHECK, TIMEOUT, DEBUG, LATENCY, LIMIT, WATCHDOG CF_GRAMMAR -CF_ADDTO(conf, log_config) +conf: log_config ; log_config: LOG log_file log_mask ';' { 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 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 LATENCY bool { new_config->latency_debug = $3; } diff --git a/sysdep/unix/krt.Y b/sysdep/unix/krt.Y index 98740b70..95b54d65 100644 --- a/sysdep/unix/krt.Y +++ b/sysdep/unix/krt.Y @@ -38,15 +38,15 @@ CF_GRAMMAR /* Kernel syncer protocol */ -CF_ADDTO(proto, kern_proto '}') +proto: kern_proto '}' ; kern_proto_start: proto_start KERNEL { this_proto = krt_init_config($1); } ; -CF_ADDTO(kern_proto, kern_proto_start proto_name '{') -CF_ADDTO(kern_proto, kern_proto kern_item ';') +kern_proto: kern_proto_start proto_name '{' ; +kern_proto: kern_proto kern_item ';' ; kern_mp_limit: /* empty */ { $$ = KRT_DEFAULT_ECMP_LIMIT; } @@ -80,13 +80,13 @@ kern_item: /* Kernel interface protocol */ -CF_ADDTO(proto, kif_proto '}') +proto: kif_proto '}' ; kif_proto_start: proto_start DEVICE { this_proto = kif_init_config($1); } ; -CF_ADDTO(kif_proto, kif_proto_start proto_name '{') -CF_ADDTO(kif_proto, kif_proto kif_item ';') +kif_proto: kif_proto_start proto_name '{' ; +kif_proto: kif_proto kif_item ';' ; kif_item: proto_item @@ -122,8 +122,8 @@ kif_iface: 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); }) -CF_ADDTO(dynamic_attr, KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_METRIC); }) +dynamic_attr: KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_SOURCE); } ; +dynamic_attr: KRT_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_METRIC); } ; CF_CODE