From 81aa1a3bb3e51bf6af86a656ebcab083b6225f18 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 28 Sep 2018 15:22:03 +0200 Subject: [PATCH] dhcp: reset @was_active on cleanup The @was_active flag indicates that we started DHCP on an assumed connection. The idea is that if DHCP succeeded before, any failure must be treated like a renewal failure (and so it should start a grace period) rather than a failure in getting an initial lease (which fails the IP method). When we clean up the DHCP instance, the flag must be reset to FALSE, otherwise it will be potentially considered for other connections. --- src/devices/nm-device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 8de4db55d8..a5b34cf3c5 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -7028,6 +7028,7 @@ dhcp4_cleanup (NMDevice *self, CleanupType cleanup_type, gboolean release) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + priv->dhcp4.was_active = FALSE; nm_clear_g_source (&priv->dhcp4.grace_id); g_clear_pointer (&priv->dhcp4.pac_url, g_free); g_clear_pointer (&priv->dhcp4.root_path, g_free); @@ -7986,6 +7987,7 @@ dhcp6_cleanup (NMDevice *self, CleanupType cleanup_type, gboolean release) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + priv->dhcp6.was_active = FALSE; priv->dhcp6.mode = NM_NDISC_DHCP_LEVEL_NONE; applied_config_clear (&priv->dhcp6.ip6_config); g_clear_pointer (&priv->dhcp6.event_id, g_free);