Commit 28e9ec49 authored by Nikolay Martynov's avatar Nikolay Martynov Committed by Thomas Haller
Browse files

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
parent 4db69c5b
......@@ -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;
}
......
......@@ -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
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment