0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 09:58:43 +00:00

Static: Fix invalid combination of nexthop options

BFD requires defined local IP, but for nexthop with onlink there might
not be such address. So we reject this combination of nexthop options.
This prevent crash where such combination of options is used.
This commit is contained in:
Ondrej Zajicek 2024-03-22 00:40:06 +01:00
parent d21a508e8d
commit a698f8d917

View File

@ -95,6 +95,8 @@ stat_nexthop:
} }
| stat_nexthop ONLINK bool { | stat_nexthop ONLINK bool {
this_snh->onlink = $3; this_snh->onlink = $3;
if (this_snh->use_bfd && this_snh->onlink)
cf_error("Options 'bfd' and 'onlink' cannot be combined");
} }
| stat_nexthop WEIGHT expr { | stat_nexthop WEIGHT expr {
this_snh->weight = $3 - 1; this_snh->weight = $3 - 1;
@ -102,6 +104,8 @@ stat_nexthop:
} }
| stat_nexthop BFD bool { | stat_nexthop BFD bool {
this_snh->use_bfd = $3; cf_check_bfd($3); this_snh->use_bfd = $3; cf_check_bfd($3);
if (this_snh->use_bfd && this_snh->onlink)
cf_error("Options 'bfd' and 'onlink' cannot be combined");
} }
; ;