summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-01-25 20:03:08 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-02-27 16:48:28 +0100
commitf6c9b4ff83b88938b59856dff9303e1b5f0d85bf (patch)
treeba6c1d335d8c6a7b4bf64d407cd8af4997644c89
parent1ee03eeb5ad1a354a70df41b2c7cc390e2007f84 (diff)
downloadNetworkManager-f6c9b4ff83b88938b59856dff9303e1b5f0d85bf.tar.gz
fake-platform: override routes that clash
This is done to more closely mimic what Linux does.
-rw-r--r--src/platform/nm-fake-platform.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 9812bb18b4..f941f75d79 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -1118,8 +1118,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)
@@ -1127,6 +1125,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;
@@ -1162,8 +1166,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)
@@ -1171,6 +1173,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;