git: 3d030136ad19 - main - route/fib_algo: Respect immediate_sync in fd_ref_nhop

From: Pouria Mousavizadeh Tehrani <pouria_at_FreeBSD.org>
Date: Tue, 22 Sep 2026 20:03:00 UTC
The branch main has been updated by pouria:

URL: https://cgit.FreeBSD.org/src/commit/?id=3d030136ad1906e6d463673a8d2ef313eb054fb3

commit 3d030136ad1906e6d463673a8d2ef313eb054fb3
Author:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-09-22 19:23:00 +0000
Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-09-22 19:23:00 +0000

    route/fib_algo: Respect immediate_sync in fd_ref_nhop
    
    Now fd_ref_nhop() returns zero for cross family routes,
    Do not schedule nhop references and try to rebuild it immediately
    for connected and static routes.
    
    PR:     298733
    Fixes:  633438224304 ("route/fib_algo: Fix nexthop index ...")
---
 sys/net/route/fib_algo.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c
index 44a8b7ff445a..edeac703fedc 100644
--- a/sys/net/route/fib_algo.c
+++ b/sys/net/route/fib_algo.c
@@ -849,8 +849,10 @@ handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc,
 	 */
 	if (rc->rc_nh_new != NULL) {
 		if (fib_ref_nhop(fd, rc->rc_nh_new) == 0) {
-			/* ran out of indexes */
-			schedule_fd_rebuild(fd, "ran out of nhop indexes");
+			if (immediate_sync)
+				rebuild_fd(fd, "ran out of nhop indexes");
+			else
+				schedule_fd_rebuild(fd, "ran out of nhop indexes");
 			return;
 		}
 	}