From a698f8d917af8e9b421a667766a42f45e9359616 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 22 Mar 2024 00:40:06 +0100 Subject: [PATCH] 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. --- proto/static/config.Y | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proto/static/config.Y b/proto/static/config.Y index 7b282898..f1825edf 100644 --- a/proto/static/config.Y +++ b/proto/static/config.Y @@ -95,6 +95,8 @@ stat_nexthop: } | stat_nexthop ONLINK bool { 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 { this_snh->weight = $3 - 1; @@ -102,6 +104,8 @@ stat_nexthop: } | stat_nexthop BFD bool { 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"); } ;