calc_min_mpath_slots_fast() selects the nexthops with the lowest
metric through wn[i].nh, but reads their weights from wn[i].storage,
a copy of the weights that is sorted independently of the nexthops.
In a group with more than one metric the weights of the wrong
nexthops are summed, and the weights of all nexthops take part in
the divisibility check, so the group gets a wrong number of slots
and a wrong traffic split.
Calculate the number of slots as the sum of the weights divided by
their greatest common divisor instead. It needs no sorted copy of
the weights and is exact where the old code gave up and used
RIB_MAX_MPATH_WIDTH slots.
Sort the nexthops of a group by metric first and by index second,
and keep the metric of each nexthop in the freed field. The
nexthops with the lowest metric are the first ones in the array.
The group is sized and compiled from them without visiting every
nexthop for its metric, and the metric argument of these functions
goes away.
decompose_change_notification() walks two groups in their sort
order, so make it use the same comparison.
Fixes: c0256b31efcc ("routing: Add support for metric")