summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/platform/nm-fake-platform.c24
-rw-r--r--src/platform/nm-platform.c28
-rw-r--r--src/platform/tests/test-address.c8
-rw-r--r--src/platform/tests/test-route.c8
4 files changed, 20 insertions, 48 deletions
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 43944721cd..d0127c4733 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -827,7 +827,7 @@ ip4_address_delete (NMPlatform *platform, int ifindex, in_addr_t addr, int plen)
}
}
- g_assert_not_reached ();
+ return TRUE;
}
static gboolean
@@ -850,7 +850,7 @@ ip6_address_delete (NMPlatform *platform, int ifindex, struct in6_addr addr, int
}
}
- g_assert_not_reached ();
+ return TRUE;
}
static gboolean
@@ -1064,11 +1064,11 @@ ip4_route_delete (NMPlatform *platform, int ifindex, in_addr_t network, int plen
NMPlatformIP4Route *route = ip4_route_get (platform, ifindex, network, plen, metric);
NMPlatformIP4Route deleted_route;
- g_assert (route);
-
- memcpy (&deleted_route, route, sizeof (deleted_route));
- memset (route, 0, sizeof (*route));
- g_signal_emit_by_name (platform, NM_PLATFORM_IP4_ROUTE_REMOVED, ifindex, &deleted_route, NM_PLATFORM_REASON_INTERNAL);
+ if (route) {
+ memcpy (&deleted_route, route, sizeof (deleted_route));
+ memset (route, 0, sizeof (*route));
+ g_signal_emit_by_name (platform, NM_PLATFORM_IP4_ROUTE_REMOVED, ifindex, &deleted_route, NM_PLATFORM_REASON_INTERNAL);
+ }
return TRUE;
}
@@ -1079,11 +1079,11 @@ ip6_route_delete (NMPlatform *platform, int ifindex, struct in6_addr network, in
NMPlatformIP6Route *route = ip6_route_get (platform, ifindex, network, plen, metric);
NMPlatformIP6Route deleted_route;
- g_assert (route);
-
- memcpy (&deleted_route, route, sizeof (deleted_route));
- memset (route, 0, sizeof (*route));
- g_signal_emit_by_name (platform, NM_PLATFORM_IP6_ROUTE_REMOVED, ifindex, &deleted_route, NM_PLATFORM_REASON_INTERNAL);
+ if (route) {
+ memcpy (&deleted_route, route, sizeof (deleted_route));
+ memset (route, 0, sizeof (*route));
+ g_signal_emit_by_name (platform, NM_PLATFORM_IP6_ROUTE_REMOVED, ifindex, &deleted_route, NM_PLATFORM_REASON_INTERNAL);
+ }
return TRUE;
}
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 8bdfaf42f1..8485e74ebe 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1282,13 +1282,6 @@ nm_platform_ip4_address_delete (int ifindex, in_addr_t address, int plen)
g_return_val_if_fail (klass->ip4_address_delete, FALSE);
debug ("address: deleting IPv4 address %s/%d", nm_utils_inet4_ntop (address, NULL), plen);
-
- if (!nm_platform_ip4_address_exists (ifindex, address, plen)) {
- debug ("address doesn't exists");
- platform->error = NM_PLATFORM_ERROR_NOT_FOUND;
- return FALSE;
- }
-
return klass->ip4_address_delete (platform, ifindex, address, plen);
}
@@ -1302,13 +1295,6 @@ nm_platform_ip6_address_delete (int ifindex, struct in6_addr address, int plen)
g_return_val_if_fail (klass->ip6_address_delete, FALSE);
debug ("address: deleting IPv6 address %s/%d", nm_utils_inet6_ntop (&address, NULL), plen);
-
- if (!nm_platform_ip6_address_exists (ifindex, address, plen)) {
- debug ("address doesn't exists");
- platform->error = NM_PLATFORM_ERROR_NOT_FOUND;
- return FALSE;
- }
-
return klass->ip6_address_delete (platform, ifindex, address, plen);
}
@@ -1581,13 +1567,6 @@ nm_platform_ip4_route_delete (int ifindex, in_addr_t network, int plen, int metr
g_return_val_if_fail (klass->ip4_route_delete, FALSE);
debug ("route: deleting IPv4 route %s/%d, metric=%d", nm_utils_inet4_ntop (network, NULL), plen, metric);
-
- if (!nm_platform_ip4_route_exists (ifindex, network, plen, metric)) {
- debug ("route not found");
- platform->error = NM_PLATFORM_ERROR_NOT_FOUND;
- return FALSE;
- }
-
return klass->ip4_route_delete (platform, ifindex, network, plen, metric);
}
@@ -1601,13 +1580,6 @@ nm_platform_ip6_route_delete (int ifindex,
g_return_val_if_fail (klass->ip6_route_delete, FALSE);
debug ("route: deleting IPv6 route %s/%d, metric=%d", nm_utils_inet6_ntop (&network, NULL), plen, metric);
-
- if (!nm_platform_ip6_route_exists (ifindex, network, plen, metric)) {
- debug ("route not found");
- platform->error = NM_PLATFORM_ERROR_NOT_FOUND;
- return FALSE;
- }
-
return klass->ip6_route_delete (platform, ifindex, network, plen, metric);
}
diff --git a/src/platform/tests/test-address.c b/src/platform/tests/test-address.c
index 0f0ccc81eb..20f1bd9ed6 100644
--- a/src/platform/tests/test-address.c
+++ b/src/platform/tests/test-address.c
@@ -89,8 +89,8 @@ test_ip4_address (void)
accept_signal (address_removed);
/* Remove address again */
- g_assert (!nm_platform_ip4_address_delete (ifindex, addr, IP4_PLEN));
- error (NM_PLATFORM_ERROR_NOT_FOUND);
+ g_assert (nm_platform_ip4_address_delete (ifindex, addr, IP4_PLEN));
+ no_error ();
free_signal (address_added);
free_signal (address_changed);
@@ -145,8 +145,8 @@ test_ip6_address (void)
accept_signal (address_removed);
/* Remove address again */
- g_assert (!nm_platform_ip6_address_delete (ifindex, addr, IP6_PLEN));
- error (NM_PLATFORM_ERROR_NOT_FOUND);
+ g_assert (nm_platform_ip6_address_delete (ifindex, addr, IP6_PLEN));
+ no_error ();
free_signal (address_added);
free_signal (address_changed);
diff --git a/src/platform/tests/test-route.c b/src/platform/tests/test-route.c
index 6c764ad3c3..f333ffc3c1 100644
--- a/src/platform/tests/test-route.c
+++ b/src/platform/tests/test-route.c
@@ -113,8 +113,8 @@ test_ip4_route ()
accept_signal (route_removed);
/* Remove route again */
- g_assert (!nm_platform_ip4_route_delete (ifindex, network, plen, metric));
- error (NM_PLATFORM_ERROR_NOT_FOUND);
+ g_assert (nm_platform_ip4_route_delete (ifindex, network, plen, metric));
+ no_error ();
free_signal (route_added);
free_signal (route_changed);
@@ -196,8 +196,8 @@ test_ip6_route ()
accept_signal (route_removed);
/* Remove route again */
- g_assert (!nm_platform_ip6_route_delete (ifindex, network, plen, metric));
- error (NM_PLATFORM_ERROR_NOT_FOUND);
+ g_assert (nm_platform_ip6_route_delete (ifindex, network, plen, metric));
+ no_error ();
free_signal (route_added);
free_signal (route_changed);