Commit 42ac0198cd for frr
commit 42ac0198cd19b464206263bfc0e09d608b068777
Author: Donald Sharp <sharpd@nvidia.com>
Date: Mon Sep 14 08:50:45 2026 -0400
zebra: Fix timing issue in route winning notifications
Suppose we have this ordering for a given prefix:
a) Receive a re from protocol A, Schedule via dplane to install
b) Receive a re from protocol B, it wins, sends BETTER_ADMIN_WON, schedules
install
c) protocol A receives BETTER_ADMIN_WON, marks it not usable
d) zebra receives notification for re protocol A install, sends
INSTALL to protocol A
e) protocol A receives INSTALLED, marks it as usable sends to peers
f) zebra receives notification for re protocol B install, sends
INSTALL to protocol B.
Fix it so that zebra does not send the INSTALL notification if
the re is not selected by the dest( since we know something
has happened in the mean time.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 3acf50baa2..7655e8af8c 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2163,22 +2163,34 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
if (zvrf)
zvrf->installs++;
- /* Notify route owner */
- if (zebra_router_notify_on_ack())
- zsend_route_notify_owner_ctx(ctx, ZAPI_ROUTE_INSTALLED);
- else {
- if (re) {
- if (CHECK_FLAG(re->flags,
- ZEBRA_FLAG_OFFLOADED))
- zsend_route_notify_owner_ctx(
- ctx,
- ZAPI_ROUTE_INSTALLED);
- if (CHECK_FLAG(
- re->flags,
- ZEBRA_FLAG_OFFLOAD_FAILED))
- zsend_route_notify_owner_ctx(
- ctx,
- ZAPI_ROUTE_FAIL_INSTALL);
+ /*
+ * Notify route owner
+ *
+ * Note this is gated on this re actually being
+ * the selected. It's possible that a re comes in
+ * is selected->installed, then another re comes
+ * in while this one is in flight to the kernel
+ * in that case this re is no longer the winner
+ * and we should not notify. Later re's will
+ * cause the winner to be shown.
+ *
+ * In this case the BETTER_ADMIN_WON message
+ * was already sent if the re is of a different
+ * protocol type.
+ */
+ if (dest && re && re == dest->selected_fib) {
+ if (zebra_router_notify_on_ack())
+ zsend_route_notify_owner_ctx(ctx, ZAPI_ROUTE_INSTALLED);
+ else {
+ if (re) {
+ if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED))
+ zsend_route_notify_owner_ctx(ctx,
+ ZAPI_ROUTE_INSTALLED);
+ if (CHECK_FLAG(re->flags,
+ ZEBRA_FLAG_OFFLOAD_FAILED))
+ zsend_route_notify_owner_ctx(ctx,
+ ZAPI_ROUTE_FAIL_INSTALL);
+ }
}
}
} else {