]> 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:01:49 +0000 (21:01 +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 af3529b5a9faca7818084a05b85c30bc246425df..a228614b7f87ccd503c18b17dcaaebf9d18eebfd 100644 (file)
@@ -536,7 +536,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, }),
@@ -547,7 +547,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, }),