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).
This commit is contained in:
Stefan Agner 2023-03-27 17:48:34 +02:00 committed by Íñigo Huguet
parent 7be55d6eff
commit f766059ea8

View file

@ -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);