]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
ASPA: fix aspa_check_upstream and aspa_check_downstream parse crash
authorMaria Matejka <mq@ucw.cz>
Wed, 21 May 2025 11:53:35 +0000 (13:53 +0200)
committerMaria Matejka <mq@ucw.cz>
Sun, 25 May 2025 19:02:51 +0000 (21:02 +0200)
Due to internal differences between BIRD 2 and 3, there is
FI_CURRENT_ROUTE in BIRD 3 and `val.rte == NULL` is not supported
as a shortcut for fetching the route object.

When merging, we forgot to fix this difference in the BGP config parser,
thus the constant folder failed to recognize that this is not a constant
expression, leading to accidentally dereference the NULL route pointer
in config parse time.

This fixes #247.

proto/bgp/config.Y

index aafd44ff75fe0e378345cd7112f9207ee9a41c4d..daca00c4f6a0dcdd29bf0cff9ea239c44686bc7a 100644 (file)
@@ -389,7 +389,7 @@ CF_CLI(RELOAD BGP OUT, proto_patt, [<name>], [[Refresh routes to neighbor]])
 term: ASPA_CHECK_DOWNSTREAM '(' rtable ')' { $$ =
   f_new_inst(FI_ASPA_CHECK_EXPLICIT,
       f_new_inst(FI_EA_GET,
-       f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_ROUTE, .val.rte = NULL, }),
+       f_new_inst(FI_CURRENT_ROUTE),
        ea_class_find_by_name("bgp_path")
       ),
       f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_BOOL, .val.i = 0, }),
@@ -400,7 +400,7 @@ term: ASPA_CHECK_DOWNSTREAM '(' rtable ')' { $$ =
 term: ASPA_CHECK_UPSTREAM '(' rtable ')' { $$ =
   f_new_inst(FI_ASPA_CHECK_EXPLICIT,
       f_new_inst(FI_EA_GET,
-       f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_ROUTE, .val.rte = NULL, }),
+       f_new_inst(FI_CURRENT_ROUTE),
        ea_class_find_by_name("bgp_path")
       ),
       f_new_inst(FI_CONSTANT, (struct f_val) { .type = T_BOOL, .val.i = 1, }),