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
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user