diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-09-05 09:24:33 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-09-06 09:07:41 +0200 |
commit | 53d9050b3690f2076f38f423381552c844498731 (patch) | |
tree | fb37eb326f620a53373394a5451ddabc3c7ccf68 /src/devices/nm-device-ethernet.c | |
parent | ffea27a581dcbea9020e9902eace4a3953727d4a (diff) | |
download | NetworkManager-53d9050b3690f2076f38f423381552c844498731.tar.gz |
core: add nm_config_data_get_connection_default_int64()
Diffstat (limited to 'src/devices/nm-device-ethernet.c')
-rw-r--r-- | src/devices/nm-device-ethernet.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 4d4624b7f8..0fb8fea42c 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -1198,7 +1198,6 @@ wake_on_lan_enable (NMDevice *device) NMSettingWiredWakeOnLan wol; NMSettingWired *s_wired; const char *password = NULL; - gs_free char *value = NULL; s_wired = (NMSettingWired *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_WIRED); if (s_wired) { @@ -1208,27 +1207,25 @@ wake_on_lan_enable (NMDevice *device) goto found; } - value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA, - "ethernet.wake-on-lan", - device); - - if (value) { - wol = _nm_utils_ascii_str_to_int64 (value, 10, - NM_SETTING_WIRED_WAKE_ON_LAN_NONE, - G_MAXINT32, - NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT); - - if ( NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS) - && !nm_utils_is_power_of_two (wol)) { - nm_log_dbg (LOGD_ETHER, "invalid default value %u for wake-on-lan", (guint) wol); - wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT; - } - if (wol != NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT) - goto found; + wol = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA, + "ethernet.wake-on-lan", + device, + NM_SETTING_WIRED_WAKE_ON_LAN_NONE, + G_MAXINT32, + NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT); + + if ( NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS) + && !nm_utils_is_power_of_two (wol)) { + nm_log_dbg (LOGD_ETHER, "invalid default value %u for wake-on-lan", (guint) wol); + wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT; } + 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), wol, password); + return nm_platform_ethtool_set_wake_on_lan (nm_device_get_platform (device), + nm_device_get_ifindex (device), + wol, password); } /*****************************************************************************/ |