batman-adv: bat_v: fix bonding candidate selection

batadv_v_neigh_is_sob() implements the metric (throughput) similarity check
as:

  neigh2 (the reference) has a better throughput than 3/4 of the neigh1
  (candidate) throughput

But this results in a selection of bonding candidates in
batadv_find_router() which have a really low throughput. But the goal must
be to select candidates which have a good throughput.

The neigh1/neigh2 operands must be swapped in the comparison to use the
reference as such and select only neighbor+interface combinations with good
throughput.

Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
Sven Eckelmann 2026-08-06 20:54:53 +02:00
parent b963ee1dc3
commit 77f653e6f7
No known key found for this signature in database
GPG Key ID: 4D0F772BD314F5CB

View File

@ -519,8 +519,8 @@ static int batadv_v_neigh_cmp(struct batadv_neigh_node *neigh1,
* @neigh2: second neighbour to compare
* @if_outgoing2: outgoing interface to use for @neigh2
*
* Return: true if the throughput of @neigh2 is at least 3/4 of the
* @neigh1 throughput
* Return: true if the throughput of @neigh1 is at least 3/4 of the
* @neigh2 throughput
*/
static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
struct batadv_hard_iface *if_outgoing1,
@ -540,10 +540,10 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
if (!ifinfo2)
goto err_ifinfo2;
threshold = ifinfo1->bat_v.throughput / 4;
threshold = ifinfo1->bat_v.throughput - threshold;
threshold = ifinfo2->bat_v.throughput / 4;
threshold = ifinfo2->bat_v.throughput - threshold;
ret = ifinfo2->bat_v.throughput > threshold;
ret = ifinfo1->bat_v.throughput > threshold;
batadv_neigh_ifinfo_put(ifinfo2);
err_ifinfo2: