about summary refs log tree commit diff
path: root/src/core/devices/nm-device-ethernet.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2022-11-18 17:49:21 +0100
committerMichael Biebl <biebl@debian.org>2022-11-18 17:49:21 +0100
commit35b6136bc39c77da74de1325e13871bc985c5352 (patch)
treef5d91944aa7b1df3b4cf397e617e9af9cfea89cf /src/core/devices/nm-device-ethernet.c
parentc9f38062acbf43edb3b33c336ba19a449664c3de (diff)
parent913bcb40f6c699f8a38351c69e7ea263fe78f71f (diff)
Update upstream source from tag 'upstream/1.40.4'
Update to upstream version '1.40.4'
with Debian dir 7084cdfc71b038bf79ea5f3c53dfea86e49c80cb
Diffstat (limited to 'src/core/devices/nm-device-ethernet.c')
-rw-r--r--src/core/devices/nm-device-ethernet.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/devices/nm-device-ethernet.c b/src/core/devices/nm-device-ethernet.c
index 40c6d208..4788cdc6 100644
--- a/src/core/devices/nm-device-ethernet.c
+++ b/src/core/devices/nm-device-ethernet.c
@@ -1354,6 +1354,11 @@ wake_on_lan_enable(NMDevice *device)
     if (s_wired) {
         wol      = nm_setting_wired_get_wake_on_lan(s_wired);
         password = nm_setting_wired_get_wake_on_lan_password(s_wired);
+
+        /* NMSettingWired does not reject invalid flags. Filter them out here. */
+        wol = (wol
+               & (NM_SETTING_WIRED_WAKE_ON_LAN_ALL | NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS));
+
         if (wol != NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
             goto found;
     }
@@ -1370,9 +1375,14 @@ wake_on_lan_enable(NMDevice *device)
         nm_log_dbg(LOGD_ETHER, "invalid default value %u for wake-on-lan", (guint) wol);
         wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
     }
+
+    wol = wol & (NM_SETTING_WIRED_WAKE_ON_LAN_ALL | NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS);
+
     if (wol != NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
         goto found;
+
     wol = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
+
 found:
     return nm_platform_ethtool_set_wake_on_lan(nm_device_get_platform(device),
                                                nm_device_get_ifindex(device),