summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-09-02 10:14:35 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-09-08 13:23:14 +0200
commit998ab889495c18c62766b62441d72a8bcd84e6ff (patch)
treeb6d8a4823f89926df9239c9dfe6a99726e8ba62b
parent1c46ddf196b1e87782049e8f9ee3ada93e0dc85b (diff)
downloadNetworkManager-998ab889495c18c62766b62441d72a8bcd84e6ff.tar.gz
device: retry DHCP after timeout/expiration for assumed connections
If DHCP fails for an assumed connection, NetworkManager would transition the device to the FAILED and then to the ACTIVATED state (because it is assumed); hence if the DHCP server goes temporarily down the device will go into a permanent state without IP configuration. Fix this and try DHCP again after some time when the connection is an assumed one. https://bugzilla.redhat.com/show_bug.cgi?id=1246496
-rw-r--r--src/devices/nm-device.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index f4c1f730d8..c1d57cbfd0 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3655,6 +3655,16 @@ dhcp4_fail (NMDevice *self, gboolean timeout)
return;
}
+ /* Instead of letting an assumed connection fail (which means that the
+ * device will transition to the ACTIVATED state without IP configuration),
+ * retry DHCP again.
+ */
+ if (nm_device_uses_assumed_connection (self)) {
+ _LOGI (LOGD_DHCP4, "Scheduling DHCPv4 restart because the connection is assumed");
+ priv->dhcp4_restart_id = g_timeout_add_seconds (120, dhcp4_restart_cb, self);
+ return;
+ }
+
if (timeout || (priv->ip4_state == IP_CONF))
nm_device_activate_schedule_ip4_config_timeout (self);
else if (priv->ip4_state == IP_DONE)
@@ -4314,6 +4324,16 @@ dhcp6_fail (NMDevice *self, gboolean timeout)
return;
}
+ /* Instead of letting an assumed connection fail (which means that the
+ * device will transition to the ACTIVATED state without IP configuration),
+ * retry DHCP again.
+ */
+ if (nm_device_uses_assumed_connection (self)) {
+ _LOGI (LOGD_DHCP6, "Scheduling DHCPv6 restart because the connection is assumed");
+ priv->dhcp6_restart_id = g_timeout_add_seconds (120, dhcp6_restart_cb, self);
+ return;
+ }
+
if (timeout || (priv->ip6_state == IP_CONF))
nm_device_activate_schedule_ip6_config_timeout (self);
else if (priv->ip6_state == IP_DONE)