git: de639dcde2e2 - main - routing: Enable hash_outbound during nhgrp allocation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Jun 2026 10:23:00 UTC
The branch main has been updated by pouria:
URL: https://cgit.FreeBSD.org/src/commit/?id=de639dcde2e273a6e6f2e877054c0606f9a8da25
commit de639dcde2e273a6e6f2e877054c0606f9a8da25
Author: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-06-05 12:12:18 +0000
Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-06-11 10:20:56 +0000
routing: Enable hash_outbound during nhgrp allocation
Multipath routes can be added via both RTM_F_CREATE and RTM_F_APPEND.
Therefore, it's possible to have mpath routes without calling
add_route_flags_mpath.
Instead of checking V_fib_hash_outbound for every route append,
check it during nhgrp_ctl initialization, which is only called for
the first multipath request per rib_head.
PR: 293136
Reviewed by: glebius
Tested by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Differential Revision: https://reviews.freebsd.org/D57469
---
sys/net/route/nhgrp_ctl.c | 6 ++++++
sys/net/route/route_ctl.c | 15 +--------------
2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c
index d0f954888997..d684cd698284 100644
--- a/sys/net/route/nhgrp_ctl.c
+++ b/sys/net/route/nhgrp_ctl.c
@@ -505,6 +505,12 @@ nhgrp_alloc(uint32_t fibnum, int family, struct weightened_nhop *wn, int num_nho
*perror = ENOMEM;
return (NULL);
}
+ if (V_fib_hash_outbound == 0) {
+ /* Enable local outbound connections hashing. */
+ if (bootverbose)
+ printf("FIB: enabled flowid calculation for locally-originated packets\n");
+ V_fib_hash_outbound = 1;
+ }
}
/* Sort nexthops & check there are no duplicates */
diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c
index cfa3b52b63a6..fa0f41a0a559 100644
--- a/sys/net/route/route_ctl.c
+++ b/sys/net/route/route_ctl.c
@@ -876,21 +876,8 @@ add_route_flags_mpath(struct rib_head *rnh, struct rtentry *rt,
}
return (error);
}
- error = change_route_conditional(rnh, rt, rnd_orig, &rnd_new, rc);
- if (error != 0)
- return (error);
-
- if (V_fib_hash_outbound == 0 && NH_IS_NHGRP(rc->rc_nh_new)) {
- /*
- * First multipath route got installed. Enable local
- * outbound connections hashing.
- */
- if (bootverbose)
- printf("FIB: enabled flowid calculation for locally-originated packets\n");
- V_fib_hash_outbound = 1;
- }
- return (0);
+ return (change_route_conditional(rnh, rt, rnd_orig, &rnd_new, rc));
}
/*