diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2020-04-26 17:47:32 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2023-10-11 17:39:41 +0900 |
commit | 27ce5693a8392e951179a2e403a4d493cd6942cf (patch) | |
tree | 3e2c4cf1d2c60c6dcf1b9b097c547b3ffb4e6ded | |
parent | 0e1fbaa5b21db8e5c64a732dbaf0b8afe707a147 (diff) | |
download | bird-ky/trailing-comma.tar.gz |
Filter: Allow trailing comma in set literalsky/trailing-comma
-rw-r--r-- | filter/config.Y | 12 | ||||
-rw-r--r-- | proto/l3vpn/config.Y | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/filter/config.Y b/filter/config.Y index f3ed2dc5..2a28333c 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -722,6 +722,10 @@ ec_items: | ec_items ',' ec_item { $$ = f_merge_items($1, $3); } ; +comma_opt: + | ',' + ; + set_items: set_item | set_items ',' set_item { $$ = f_merge_items($1, $3); } @@ -778,9 +782,9 @@ bgp_path_tail: NUM bgp_path_tail { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_PATH_MASK_ITEM, .val.pmi = { .asn = $1, .kind = PM_ASN, }, }); $$->next = $2; } | NUM DDOT NUM bgp_path_tail { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_PATH_MASK_ITEM, .val.pmi = { .from = $1, .to = $3, .kind = PM_ASN_RANGE }, }); $$->next = $4; } | '[' ']' bgp_path_tail { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_PATH_MASK_ITEM, .val.pmi = { .set = NULL, .kind = PM_ASN_SET }, }); $$->next = $3; } - | '[' set_items ']' bgp_path_tail { + | '[' set_items comma_opt ']' bgp_path_tail { if ($2->from.type != T_INT) cf_error("Only integer sets allowed in path mask"); - $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_PATH_MASK_ITEM, .val.pmi = { .set = build_tree($2), .kind = PM_ASN_SET }, }); $$->next = $4; + $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_PATH_MASK_ITEM, .val.pmi = { .set = build_tree($2), .kind = PM_ASN_SET }, }); $$->next = $5; } | '*' bgp_path_tail { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_PATH_MASK_ITEM, .val.pmi = { .kind = PM_ASTERISK }, }); $$->next = $2; } | '?' bgp_path_tail { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_PATH_MASK_ITEM, .val.pmi = { .kind = PM_QUESTION }, }); $$->next = $2; } @@ -799,12 +803,12 @@ constant: | VPN_RD { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_RD, .val.ec = $1, }); } | net_ { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_NET, .val.net = $1, }); } | '[' ']' { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_SET, .val.t = NULL, }); } - | '[' set_items ']' { + | '[' set_items comma_opt ']' { DBG( "We've got a set here..." ); $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_SET, .val.t = build_tree($2), }); DBG( "ook\n" ); } - | '[' fprefix_set ']' { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_PREFIX_SET, .val.ti = $2, }); } + | '[' fprefix_set comma_opt ']' { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_PREFIX_SET, .val.ti = $2, }); } | ENUM { $$ = f_new_inst(FI_CONSTANT, (struct f_val) { .type = $1 >> 16, .val.i = $1 & 0xffff, }); } ; diff --git a/proto/l3vpn/config.Y b/proto/l3vpn/config.Y index e16e0c48..dbafa1dd 100644 --- a/proto/l3vpn/config.Y +++ b/proto/l3vpn/config.Y @@ -92,7 +92,7 @@ l3vpn_proto: l3vpn_targets: ec_item { f_tree_only_rt($1); $$ = $1; } - | '[' ec_items ']' { f_tree_only_rt($2); $$ = build_tree($2); } + | '[' ec_items comma_opt ']' { f_tree_only_rt($2); $$ = build_tree($2); } ; |