summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Martynov <mar.kolya@gmail.com>2016-03-26 01:26:36 -0400
committerThomas Haller <thaller@redhat.com>2016-03-31 16:31:34 +0200
commit28e9ec499a7517f35cc5093e9b545302094e55d4 (patch)
tree2f259836fcf248676e2604c66a58b2c0d1b622b2
parent4db69c5b520c15f25390a5b9c26db53c6397e5c8 (diff)
downloadNetworkManager-28e9ec499a7517f35cc5093e9b545302094e55d4.tar.gz
device: renew dhcp leases on awake for software devices
This makes sure that devices like bond get their dhcp renewed [thaller@redhat.com: original patch modified to rename now-public function update_dynamic_ip_setup()] https://bugzilla.gnome.org/show_bug.cgi?id=764398
-rw-r--r--src/devices/nm-device.c16
-rw-r--r--src/devices/nm-device.h1
-rw-r--r--src/nm-manager.c7
3 files changed, 17 insertions, 7 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e808bf07af..50858333aa 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1238,14 +1238,18 @@ set_unmanaged_external_down (NMDevice *self)
NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED);
}
-static void
-update_dynamic_ip_setup (NMDevice *self)
+void
+nm_device_update_dynamic_ip_setup (NMDevice *self)
{
- NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ NMDevicePrivate *priv;
GError *error;
gconstpointer addr;
size_t addr_length;
+ g_return_if_fail (NM_IS_DEVICE (self));
+
+ priv = NM_DEVICE_GET_PRIVATE (self);
+
g_hash_table_remove_all (priv->ip6_saved_properties);
if (priv->dhcp4_client) {
@@ -1335,7 +1339,7 @@ carrier_changed (NMDevice *self, gboolean carrier)
* tagged for carrier ignore) ensure that when the carrier appears we
* renew DHCP leases and such.
*/
- update_dynamic_ip_setup (self);
+ nm_device_update_dynamic_ip_setup (self);
}
} else {
if (priv->state == NM_DEVICE_STATE_UNAVAILABLE) {
@@ -1532,7 +1536,7 @@ device_link_changed (NMDevice *self)
/* Update DHCP, etc, if needed */
if (ip_ifname_changed)
- update_dynamic_ip_setup (self);
+ nm_device_update_dynamic_ip_setup (self);
priv->up = NM_FLAGS_HAS (info.n_ifi_flags, IFF_UP);
@@ -1587,7 +1591,7 @@ device_ip_link_changed (NMDevice *self)
priv->ip_iface = g_strdup (pllink->name);
_notify (self, PROP_IP_IFACE);
- update_dynamic_ip_setup (self);
+ nm_device_update_dynamic_ip_setup (self);
}
return G_SOURCE_REMOVE;
}
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index ce715e68d2..f5983c727c 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -564,6 +564,7 @@ void nm_device_reactivate_ip6_config (NMDevice *device,
void nm_device_update_hw_address (NMDevice *self);
void nm_device_update_initial_hw_address (NMDevice *self);
+void nm_device_update_dynamic_ip_setup (NMDevice *self);
G_END_DECLS
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 1744632d88..1694b4324f 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -3897,8 +3897,13 @@ do_sleep_wake (NMManager *self, gboolean sleeping_changed)
NMDevice *device = NM_DEVICE (iter->data);
guint i;
- if (nm_device_is_software (device))
+ if (nm_device_is_software (device)) {
+ /* We do not manage/unmanage software devices but
+ * their dhcp leases could have gone stale so we need
+ * to renew them */
+ nm_device_update_dynamic_ip_setup (device);
continue;
+ }
/* enable/disable wireless devices since that we don't respond
* to killswitch changes during sleep.