diff options
| author | Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> | 2026-06-05 12:12:18 +0000 |
|---|---|---|
| committer | Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> | 2026-06-11 10:20:56 +0000 |
| commit | de639dcde2e273a6e6f2e877054c0606f9a8da25 (patch) | |
| tree | f912934021ddffa21055ff42c951c7949a36d211 | |
| parent | 93a234a694f37d373acf303a247d129dda28044e (diff) | |
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
| -rw-r--r-- | sys/net/route/nhgrp_ctl.c | 6 | ||||
| -rw-r--r-- | 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)); } /* |
