diff options
author | Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com> | 2018-05-25 17:46:33 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-06-15 09:46:26 +0200 |
commit | ca3bbede746a7d7031ba6a011c69ad7adb1dca3e (patch) | |
tree | cdbec67e3d4c3405f36b7741d3268d0083457b0d | |
parent | ea10016d242c42b86d68d3bae8e5be8d58533671 (diff) |
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
-rw-r--r-- | src/nm-manager.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index c594f9b74..c6d82c9d4 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -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; } @@ -5139,12 +5150,6 @@ done: } 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) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); |