]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Static: Fix invalid combination of nexthop options
authorOndrej Zajicek <santiago@crfreenet.org>
Thu, 21 Mar 2024 23:40:06 +0000 (00:40 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Thu, 21 Mar 2024 23:40:06 +0000 (00:40 +0100)
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

index 7b282898a1222f1db31403e13686df0c24c1b224..f1825edffd7ce25d763192c3daae074952d1b294 100644 (file)
@@ -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");
   }
 ;