mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-30 22:10:29 +01:00
core: fail activation when a route cannot be added
Before, when a route failed to be added, NM stopped adding further routes. However, the activation still continued and the user was not notified about the error. Adding a route might fail for example if the gateway is not on one of the subnets of the interface. Now, a failure to add a route makes the activaion fail. If the connection has autoconnect=yes, this might result in some unsuccessful reconnection attempts. In the future, we might want to distinguish between manually added routes and routes from RA/DHCP. So that connecting to a wrongly configured DHCP server still works for most parts. https://bugzilla.redhat.com/show_bug.cgi?id=999544 Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
179dae7c68
commit
fbde824584
2 changed files with 7 additions and 3 deletions
|
|
@ -137,6 +137,7 @@ nm_ip4_config_commit (NMIP4Config *config, int ifindex, int priority)
|
|||
int count = nm_ip4_config_get_num_routes (config);
|
||||
GArray *routes = g_array_sized_new (FALSE, FALSE, sizeof (NMPlatformIP4Route), count);
|
||||
NMPlatformIP4Route route;
|
||||
gboolean success;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
memcpy (&route, nm_ip4_config_get_route (config, i), sizeof (route));
|
||||
|
|
@ -157,8 +158,10 @@ nm_ip4_config_commit (NMIP4Config *config, int ifindex, int priority)
|
|||
g_array_append_val (routes, route);
|
||||
}
|
||||
|
||||
nm_platform_ip4_route_sync (ifindex, routes);
|
||||
success = nm_platform_ip4_route_sync (ifindex, routes);
|
||||
g_array_unref (routes);
|
||||
if (!success)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* MTU */
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ nm_ip6_config_commit (NMIP6Config *config, int ifindex, int priority)
|
|||
{
|
||||
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
||||
int i;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (ifindex > 0, FALSE);
|
||||
g_return_val_if_fail (config != NULL, FALSE);
|
||||
|
|
@ -159,11 +160,11 @@ nm_ip6_config_commit (NMIP6Config *config, int ifindex, int priority)
|
|||
g_array_append_val (routes, route);
|
||||
}
|
||||
|
||||
nm_platform_ip6_route_sync (ifindex, routes);
|
||||
success = nm_platform_ip6_route_sync (ifindex, routes);
|
||||
g_array_unref (routes);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return success;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue