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.
This commit is contained in:
Beniamino Galvani 2018-09-28 15:22:03 +02:00
parent 54064144d4
commit 81aa1a3bb3

View file

@ -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);