ndisc: fix ordering of routes

When no existing route has lower priority than the new one, insert
at the end of the array instead of at the beginning. This is the
same fix that was applied to gateways.

Fixes: b324b970bc ('rdisc: fix double-addition of gateways & routes if priority increases')
This commit is contained in:
Beniamino Galvani 2026-05-30 19:05:00 +02:00
parent 5b53f8c218
commit e95d775569

View file

@ -768,7 +768,7 @@ nm_ndisc_add_route(NMNDisc *ndisc, const NMNDiscRoute *new_item, gint64 now_msec
return FALSE;
}
g_array_insert_val(rdata->routes, insert_idx == G_MAXUINT ? 0u : insert_idx, *new_item);
g_array_insert_val(rdata->routes, insert_idx == G_MAXUINT ? rdata->routes->len : insert_idx, *new_item);
return TRUE;
}