summaryrefslogtreecommitdiff
path: root/src/settings/plugins/ifcfg-rh/writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings/plugins/ifcfg-rh/writer.c')
-rw-r--r--src/settings/plugins/ifcfg-rh/writer.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index 146cd34096..8bdc1028ab 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -42,6 +42,8 @@
#include <nm-setting-team-port.h>
#include "nm-core-internal.h"
#include <nm-utils.h>
+#include "nm-core-internal.h"
+#include "nm-macros-internal.h"
#include "nm-logging.h"
#include "gsystem-local-alloc.h"
@@ -1048,6 +1050,8 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
const char *const *s390_subchannels;
GString *str;
const char * const *macaddr_blacklist;
+ NMSettingWiredWakeOnLan wol;
+ const char *wol_password;
s_wired = nm_connection_get_setting_wired (connection);
if (!s_wired) {
@@ -1131,6 +1135,37 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
g_string_free (str, TRUE);
}
+ wol = nm_setting_wired_get_wake_on_lan (s_wired);
+ wol_password = nm_setting_wired_get_wake_on_lan_password (s_wired);
+ 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 ");
+
+ if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_PHY))
+ g_string_append (str, "p");
+ if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST))
+ g_string_append (str, "u");
+ if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST))
+ g_string_append (str, "m");
+ if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST))
+ g_string_append (str, "b");
+ if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_ARP))
+ g_string_append (str, "a");
+ 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);
+
+ svSetValue (ifcfg, "ETHTOOL_OPTS", str->str, FALSE);
+ g_string_free (str, TRUE);
+ }
+
svSetValue (ifcfg, "TYPE", TYPE_ETHERNET, FALSE);
return TRUE;