summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-03-15 12:03:23 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2016-03-15 14:00:57 +0100
commit3798f513ae2e20572e9b905a3a9b35fa42a3b02d (patch)
tree8b1493d1b77c4de9a19e4f2494bbe05c44b0c5b8
parentfcddaadc1bbc4a06683ec360a8a5bdf34433d72d (diff)
downloadNetworkManager-bg/dhcp-assumed-generated-route-rh1265239.tar.gz
device: take care of default route of DHCP generated-assumed connectionsbg/dhcp-assumed-generated-route-rh1265239
In general we don't touch the externally set default route on devices that use a generated-assumed connection. When the IP method is AUTO (or DHCP), this means that we are not able to restore the default route after a temporary expiration of the lease which removes addresses/routes from the device. Change this, and let NM update the default route for generated-assumed devices using dynamic addressing. https://bugzilla.redhat.com/show_bug.cgi?id=1265239
-rw-r--r--src/devices/nm-device.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index fce8a990d7..400b6c2e88 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -4212,6 +4212,7 @@ ip4_config_merge_and_apply (NMDevice *self,
gboolean routes_full_sync;
gboolean ignore_auto_routes = FALSE;
gboolean ignore_auto_dns = FALSE;
+ gboolean auto_method = FALSE;
/* Merge all the configs into the composite config */
if (config) {
@@ -4227,6 +4228,10 @@ ip4_config_merge_and_apply (NMDevice *self,
if (s_ip4) {
ignore_auto_routes = nm_setting_ip_config_get_ignore_auto_routes (s_ip4);
ignore_auto_dns = nm_setting_ip_config_get_ignore_auto_dns (s_ip4);
+
+ if (nm_streq0 (nm_setting_ip_config_get_method (s_ip4),
+ NM_SETTING_IP4_CONFIG_METHOD_AUTO))
+ auto_method = TRUE;
}
}
@@ -4282,10 +4287,12 @@ ip4_config_merge_and_apply (NMDevice *self,
goto END_ADD_DEFAULT_ROUTE;
}
- if (nm_device_uses_generated_assumed_connection (self)) {
- /* a generate-assumed-connection always detects the default route from platform */
+ /* a generated-assumed connection detects the default route from the platform,
+ * but if the IP method is automatic we need to update the default route to
+ * maintain connectivity.
+ */
+ if (nm_device_uses_generated_assumed_connection (self) && !auto_method)
goto END_ADD_DEFAULT_ROUTE;
- }
/* At this point, we treat assumed and non-assumed connections alike.
* For assumed connections we do that because we still manage RA and DHCP
@@ -4935,6 +4942,7 @@ ip6_config_merge_and_apply (NMDevice *self,
gboolean routes_full_sync;
gboolean ignore_auto_routes = FALSE;
gboolean ignore_auto_dns = FALSE;
+ gboolean auto_method = FALSE;
/* Apply ignore-auto-routes and ignore-auto-dns settings */
connection = nm_device_get_applied_connection (self);
@@ -4944,6 +4952,11 @@ ip6_config_merge_and_apply (NMDevice *self,
if (s_ip6) {
ignore_auto_routes = nm_setting_ip_config_get_ignore_auto_routes (s_ip6);
ignore_auto_dns = nm_setting_ip_config_get_ignore_auto_dns (s_ip6);
+
+ if (NM_IN_STRSET (nm_setting_ip_config_get_method (s_ip6),
+ NM_SETTING_IP6_CONFIG_METHOD_AUTO,
+ NM_SETTING_IP6_CONFIG_METHOD_DHCP))
+ auto_method = TRUE;
}
}
@@ -5007,10 +5020,12 @@ ip6_config_merge_and_apply (NMDevice *self,
goto END_ADD_DEFAULT_ROUTE;
}
- if (nm_device_uses_generated_assumed_connection (self)) {
- /* a generate-assumed-connection always detects the default route from platform */
+ /* a generated-assumed connection detects the default route from the platform,
+ * but if the IP method is automatic we need to update the default route to
+ * maintain connectivity.
+ */
+ if (nm_device_uses_generated_assumed_connection (self) && !auto_method)
goto END_ADD_DEFAULT_ROUTE;
- }
/* At this point, we treat assumed and non-assumed connections alike.
* For assumed connections we do that because we still manage RA and DHCP