summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_zebra.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-03-22 16:35:28 +0100
committerDonald Sharp <sharpd@nvidia.com>2023-03-22 16:35:28 +0100
commit3fdb2079f6ba6d9dd94386ba471055cdc9295147 (patch)
treeab7396359c9ba86a4e6c5669b008a04cae0fdf6a /bgpd/bgp_zebra.c
parentMerge pull request #13075 from donaldsharp/bgp_route_debugs (diff)
downloadfrr-3fdb2079f6ba6d9dd94386ba471055cdc9295147.tar.xz
frr-3fdb2079f6ba6d9dd94386ba471055cdc9295147.zip
bgpd: Ensure suppress-fib-pending works with network statements
The flag for telling BGP that a route is expected to be installed first before notifying a peer was always being set upon receipt of a path that could be accepted as bestpath. This is not correct: imagine that you have a peer sending you a route and you have a network statement that covers the same route. Irrelevant if the network statement would win the flag on the dest was being set in bgp_update. Thus you could get into a situation where the network statement path wins but since the flag is set on the node, it will never be announced to a peer. Let's just move the setting of the flag into bgp_zebra_announce and _withdraw. In _announce set the flag to TRUE when suppress-fib is enabled. In _withdraw just always unset the flag as that a withdrawal does not need to wait for rib removal before announcing. This will cover the case when a network statement is added after the route has been learned from a peer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_zebra.c')
-rw-r--r--bgpd/bgp_zebra.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index da598993d..81be7cd7b 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1309,6 +1309,14 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
uint32_t bos = 0;
uint32_t exp = 0;
+ /*
+ * BGP is installing this route and bgp has been configured
+ * to suppress announcements until the route has been installed
+ * let's set the fact that we expect this route to be installed
+ */
+ if (BGP_SUPPRESS_FIB_ENABLED(bgp))
+ SET_FLAG(dest->flags, BGP_NODE_FIB_INSTALL_PENDING);
+
/* Don't try to install if we're not connected to Zebra or Zebra doesn't
* know of this instance.
*/
@@ -1760,6 +1768,12 @@ void bgp_zebra_withdraw(const struct prefix *p, struct bgp_path_info *info,
struct zapi_route api;
struct peer *peer;
+ /*
+ * If we are withdrawing the route, we don't need to have this
+ * flag set. So unset it.
+ */
+ UNSET_FLAG(info->net->flags, BGP_NODE_FIB_INSTALL_PENDING);
+
/* Don't try to install if we're not connected to Zebra or Zebra doesn't
* know of this instance.
*/