Page MenuHomeFreeBSD

routing: actually sort nexthops in nhgs by # ascending.
ClosedPublic

Authored by melifaro on Jun 25 2022, 8:06 PM.
Tags
None
Referenced Files
F101851768: D35599.id107388.diff
Mon, Nov 4, 4:59 PM
Unknown Object (File)
Thu, Oct 17, 10:15 AM
Unknown Object (File)
Thu, Oct 17, 4:07 AM
Unknown Object (File)
Wed, Oct 16, 4:41 PM
Unknown Object (File)
Mon, Oct 14, 4:35 PM
Unknown Object (File)
Fri, Oct 11, 9:59 PM
Unknown Object (File)
Thu, Oct 10, 10:23 AM
Unknown Object (File)
Oct 4 2024, 10:12 AM
Subscribers

Details

Summary

Nexthops in the nexthop groups needs to be deterministically sorted by some of their property to simplify reporting when changing between large next hop-groups.

Fix reporting by actually sorting next hops by their indices (wn_cmp_idx()). calc_min_mpath_slots_fast() has different assumption - that next hops are sorted using their relative weight in the nexthop groups, which is now broken. The latter sorting is required to quickly determine the layout of the next hops in the actual forwarding group (how do we split the traffic between nhops with weights 19,31 and 47?). Note that this is only required during nexthop group creation. Note also that normally all next hops would be of the same weight.
With that in mind, (a) use spare 32 bytes inside struct weightened_nexthop to avoid memory allocation for such sorted array and (b) use insertion sort to sort the nexthop weights.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46118
Build 43007: arc lint + arc unit