From e95d7755692318365cb1597ef61d531d6c8eb6f8 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Sat, 30 May 2026 19:05:00 +0200 Subject: [PATCH] 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: b324b970bc57 ('rdisc: fix double-addition of gateways & routes if priority increases') --- src/core/ndisc/nm-ndisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ndisc/nm-ndisc.c b/src/core/ndisc/nm-ndisc.c index ed34f088a0..cc2723c44b 100644 --- a/src/core/ndisc/nm-ndisc.c +++ b/src/core/ndisc/nm-ndisc.c @@ -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; }