device: restart DHCP only for devices that are active or activating

do_sleep_wake() tries to restart DHCP for all devices, even ones that
are disconnecting. When a device is disconnecting, it still has a DHCP
client instance but we shouldn't restart it because it makes no sense;
and especially, the device could be already removed.

https://bugzilla.redhat.com/show_bug.cgi?id=1852612
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/561
(cherry picked from commit 2c50438987)
(cherry picked from commit 5321490180)
(cherry picked from commit ef755588ad)
(cherry picked from commit da54b35af3)
This commit is contained in:
Beniamino Galvani 2020-07-02 17:38:10 +02:00 committed by Thomas Haller
parent 692689ead8
commit b0be1285cc
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -3460,6 +3460,10 @@ nm_device_update_dynamic_ip_setup (NMDevice *self)
priv = NM_DEVICE_GET_PRIVATE (self);
if ( priv->state < NM_DEVICE_STATE_IP_CONFIG
|| priv->state > NM_DEVICE_STATE_ACTIVATED)
return;
g_hash_table_remove_all (priv->ip6_saved_properties);
if (priv->dhcp4.client) {