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
This commit is contained in:

committed by
Thomas Haller

parent
4db69c5b52
commit
28e9ec499a
@@ -1238,14 +1238,18 @@ set_unmanaged_external_down (NMDevice *self)
|
|||||||
NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED);
|
NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
update_dynamic_ip_setup (NMDevice *self)
|
nm_device_update_dynamic_ip_setup (NMDevice *self)
|
||||||
{
|
{
|
||||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
NMDevicePrivate *priv;
|
||||||
GError *error;
|
GError *error;
|
||||||
gconstpointer addr;
|
gconstpointer addr;
|
||||||
size_t addr_length;
|
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);
|
g_hash_table_remove_all (priv->ip6_saved_properties);
|
||||||
|
|
||||||
if (priv->dhcp4_client) {
|
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
|
* tagged for carrier ignore) ensure that when the carrier appears we
|
||||||
* renew DHCP leases and such.
|
* renew DHCP leases and such.
|
||||||
*/
|
*/
|
||||||
update_dynamic_ip_setup (self);
|
nm_device_update_dynamic_ip_setup (self);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (priv->state == NM_DEVICE_STATE_UNAVAILABLE) {
|
if (priv->state == NM_DEVICE_STATE_UNAVAILABLE) {
|
||||||
@@ -1532,7 +1536,7 @@ device_link_changed (NMDevice *self)
|
|||||||
|
|
||||||
/* Update DHCP, etc, if needed */
|
/* Update DHCP, etc, if needed */
|
||||||
if (ip_ifname_changed)
|
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);
|
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);
|
priv->ip_iface = g_strdup (pllink->name);
|
||||||
|
|
||||||
_notify (self, PROP_IP_IFACE);
|
_notify (self, PROP_IP_IFACE);
|
||||||
update_dynamic_ip_setup (self);
|
nm_device_update_dynamic_ip_setup (self);
|
||||||
}
|
}
|
||||||
return G_SOURCE_REMOVE;
|
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_hw_address (NMDevice *self);
|
||||||
void nm_device_update_initial_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
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -3897,8 +3897,13 @@ do_sleep_wake (NMManager *self, gboolean sleeping_changed)
|
|||||||
NMDevice *device = NM_DEVICE (iter->data);
|
NMDevice *device = NM_DEVICE (iter->data);
|
||||||
guint i;
|
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;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* enable/disable wireless devices since that we don't respond
|
/* enable/disable wireless devices since that we don't respond
|
||||||
* to killswitch changes during sleep.
|
* to killswitch changes during sleep.
|
||||||
|
Reference in New Issue
Block a user