ifcfg-rh: properly write the wake-on-lan property

ETHTOOL_OPTS must be cleared when the wake-on-lan value is 'default'
and a "wol d" string must be appended when the value is 'none'.

Fixes: 2e0d0bc050
This commit is contained in:
Beniamino Galvani 2015-07-30 10:21:01 +02:00
parent e65854f609
commit cf455aa0e2

View file

@ -1136,10 +1136,11 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
g_string_free (str, TRUE);
}
svSetValue (ifcfg, "ETHTOOL_OPTS", NULL, FALSE);
wol = nm_setting_wired_get_wake_on_lan (s_wired);
wol_password = nm_setting_wired_get_wake_on_lan_password (s_wired);
if (wol) {
if (wol == NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
svSetValue (ifcfg, "ETHTOOL_OPTS", NULL, FALSE);
else {
str = g_string_sized_new (30);
g_string_append (str, "wol ");
@ -1156,6 +1157,9 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC))
g_string_append (str, "g");
if (!NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_ALL))
g_string_append (str, "d");
if (wol_password && NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC))
g_string_append_printf (str, "s sopass %s", wol_password);