diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c index 7b16ab2f8e..a8d437dc05 100644 --- a/src/platform/nm-fake-platform.c +++ b/src/platform/nm-fake-platform.c @@ -1127,8 +1127,6 @@ ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source, for (i = 0; i < priv->ip4_routes->len; i++) { NMPlatformIP4Route *item = &g_array_index (priv->ip4_routes, NMPlatformIP4Route, i); - if (item->ifindex != route.ifindex) - continue; if (item->network != route.network) continue; if (item->plen != route.plen) @@ -1136,6 +1134,12 @@ ip4_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source, if (item->metric != metric) continue; + if (item->ifindex != route.ifindex) { + ip4_route_delete (platform, item->ifindex, item->network, item->plen, item->metric); + i--; + continue; + } + memcpy (item, &route, sizeof (route)); g_signal_emit_by_name (platform, NM_PLATFORM_SIGNAL_IP4_ROUTE_CHANGED, ifindex, &route, NM_PLATFORM_SIGNAL_CHANGED, NM_PLATFORM_REASON_INTERNAL); return TRUE; @@ -1171,8 +1175,6 @@ ip6_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source, for (i = 0; i < priv->ip6_routes->len; i++) { NMPlatformIP6Route *item = &g_array_index (priv->ip6_routes, NMPlatformIP6Route, i); - if (item->ifindex != route.ifindex) - continue; if (!IN6_ARE_ADDR_EQUAL (&item->network, &route.network)) continue; if (item->plen != route.plen) @@ -1180,6 +1182,12 @@ ip6_route_add (NMPlatform *platform, int ifindex, NMIPConfigSource source, if (item->metric != metric) continue; + if (item->ifindex != route.ifindex) { + ip6_route_delete (platform, item->ifindex, item->network, item->plen, item->metric); + i--; + continue; + } + memcpy (item, &route, sizeof (route)); g_signal_emit_by_name (platform, NM_PLATFORM_SIGNAL_IP6_ROUTE_CHANGED, ifindex, &route, NM_PLATFORM_SIGNAL_CHANGED, NM_PLATFORM_REASON_INTERNAL); return TRUE;