mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 11:19:16 +02:00
core: filter out invalid Wake-On-Lan flags
NMSettingWired does not reject invalid flags. Filter them out in wake_on_lan_enable().
In practice, it makes no difference, the unknown flags were ignored anyway.
(cherry picked from commit c593834842)
This commit is contained in:
parent
40564c5d6a
commit
ee6bf84559
1 changed files with 10 additions and 0 deletions
|
|
@ -1354,6 +1354,11 @@ wake_on_lan_enable(NMDevice *device)
|
||||||
if (s_wired) {
|
if (s_wired) {
|
||||||
wol = nm_setting_wired_get_wake_on_lan(s_wired);
|
wol = nm_setting_wired_get_wake_on_lan(s_wired);
|
||||||
password = nm_setting_wired_get_wake_on_lan_password(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)
|
if (wol != NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
|
||||||
goto found;
|
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);
|
nm_log_dbg(LOGD_ETHER, "invalid default value %u for wake-on-lan", (guint) wol);
|
||||||
wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
|
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)
|
if (wol != NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
|
||||||
goto found;
|
goto found;
|
||||||
|
|
||||||
wol = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
|
wol = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
|
||||||
|
|
||||||
found:
|
found:
|
||||||
return nm_platform_ethtool_set_wake_on_lan(nm_device_get_platform(device),
|
return nm_platform_ethtool_set_wake_on_lan(nm_device_get_platform(device),
|
||||||
nm_device_get_ifindex(device),
|
nm_device_get_ifindex(device),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue