mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-10 07:58:28 +02:00
fake-platform: override routes that clash
This is done to more closely mimic what Linux does.
(cherry picked from commit f6c9b4ff83)
This commit is contained in:
parent
a3ff3fbbc0
commit
7e5981a894
1 changed files with 12 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue