From f766059ea8c4717cdd3b4f65372c1ad233403377 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Mon, 27 Mar 2023 17:48:34 +0200 Subject: [PATCH] ndisc: support multiple gateways for a single network Also check for gateway equality when deduplicate routing entries. This allows to support multiple routes to the same network using different gateways. This is useful for Thread networks where multiple BRs route to the same Thread network. If one of these BRs go offline, fallback to a different router will be much quicker if multiple entries are present. Note that quick fallback to a different router requires IPv6 reachability probe to be active. Typically Linux disables reachability probes on Linux machines which act as IPv6 gateway (when forwarding is enabled). --- src/core/ndisc/nm-ndisc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/ndisc/nm-ndisc.c b/src/core/ndisc/nm-ndisc.c index ca646a6da..a7b1adbe2 100644 --- a/src/core/ndisc/nm-ndisc.c +++ b/src/core/ndisc/nm-ndisc.c @@ -703,6 +703,7 @@ nm_ndisc_add_route(NMNDisc *ndisc, const NMNDiscRoute *new_item, gint64 now_msec * comparison is aborted, and both routes are added. */ if (IN6_ARE_ADDR_EQUAL(&item->network, &new_item->network) && item->plen == new_item->plen + && IN6_ARE_ADDR_EQUAL(&item->gateway, &new_item->gateway) && item->on_link == new_item->on_link) { if (new_item->expiry_msec <= now_msec) { g_array_remove_index(rdata->routes, i);