core: don't shutdown interfaces if they have wowlan enabled

This is to support the S5 case, where usually the NM process is
stopped. If we are stopping and WoWLAN is set for the interface,
we do not deconfigure it and keep the connection alive so we
can receive packages that will potentially wake up the system.

Note that for this work, wpa_supplicant needs to be modified too
so it does not deconfigure the wireless interface either when
stopped. The needed patches for wpa_supplicant can be found in
http://lists.infradead.org/pipermail/hostap/2018-June/038644.html
This commit is contained in:
Alfonso Sánchez-Beato 2018-05-25 17:46:33 +02:00 committed by Thomas Haller
parent ea10016d24
commit ca3bbede74

View file

@ -1558,6 +1558,12 @@ again:
}
}
static gboolean
device_is_wake_on_lan (NMPlatform *platform, NMDevice *device)
{
return nm_platform_link_get_wake_on_lan (platform, nm_device_get_ip_ifindex (device));
}
static void
remove_device (NMManager *self,
NMDevice *device,
@ -1567,14 +1573,19 @@ remove_device (NMManager *self,
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
gboolean unmanage = FALSE;
_LOG2D (LOGD_DEVICE, device, "removing device (allow_unmanage %d, managed %d)",
allow_unmanage, nm_device_get_managed (device, FALSE));
_LOG2D (LOGD_DEVICE, device, "removing device (allow_unmanage %d, managed %d, wol %d)",
allow_unmanage, nm_device_get_managed (device, FALSE),
device_is_wake_on_lan (priv->platform, device));
if (allow_unmanage && nm_device_get_managed (device, FALSE)) {
if (quitting)
unmanage = nm_device_unmanage_on_quit (device);
else {
if (quitting) {
/* Leave configured if wo(w)lan and quitting */
if (device_is_wake_on_lan (priv->platform, device))
unmanage = FALSE;
else
unmanage = nm_device_unmanage_on_quit (device);
} else {
/* the device is already gone. Unmanage it. */
unmanage = TRUE;
}
@ -5138,12 +5149,6 @@ done:
g_clear_object (&subject);
}
static gboolean
device_is_wake_on_lan (NMPlatform *platform, NMDevice *device)
{
return nm_platform_link_get_wake_on_lan (platform, nm_device_get_ip_ifindex (device));
}
static gboolean
sleep_devices_add (NMManager *self, NMDevice *device, gboolean suspending)
{