From 0a37f5cc3ebcf93e1ed52d3e5fc5f75d48518804 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Mon, 21 Sep 2015 18:24:07 +0200
Subject: [PATCH 1/4] wake-on-lan: add option to keep existing settings
Add a new 'ignore' option to NMSettingWired.wake-on-lan which disables
management of wake-on-lan by NetworkManager (i.e. the pre-existing
option will not be touched). Also, change the default behavior to be
'ignore' instead of 'disabled'.
https://bugzilla.gnome.org/show_bug.cgi?id=755182
(cherry picked from commit e587dcb16eb045f55f6cba45987be75f83d0c230)
---
clients/cli/settings.c | 13 ++++++++-----
libnm-core/nm-setting-wired.c | 11 +++++++----
libnm-core/nm-setting-wired.h | 19 ++++++++++++++-----
src/devices/nm-device-ethernet.c | 11 +++++++++--
src/platform/nm-platform-utils.c | 3 +++
src/settings/plugins/ifcfg-rh/reader.c | 21 +++++++++++++--------
src/settings/plugins/ifcfg-rh/writer.c | 4 +++-
7 files changed, 57 insertions(+), 25 deletions(-)
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index 2b42eb4..efac7b2 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -1545,7 +1545,10 @@ nmc_property_wired_set_wake_on_lan (NMSetting *setting, const char *prop,
gboolean ret;
long int t;
- if (nmc_string_to_int_base (val, 0, TRUE, 0, NM_SETTING_WIRED_WAKE_ON_LAN_ALL, &t))
+ if (nmc_string_to_int_base (val, 0, TRUE, 0,
+ NM_SETTING_WIRED_WAKE_ON_LAN_ALL
+ | NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS,
+ &t))
wol = (NMSettingWiredWakeOnLan) t;
else {
ret = nm_utils_enum_from_str (nm_setting_wired_wake_on_lan_get_type (), val,
@@ -1557,7 +1560,7 @@ nmc_property_wired_set_wake_on_lan (NMSetting *setting, const char *prop,
|| g_ascii_strcasecmp (err_token, "disabled") == 0)
wol = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
else {
- g_set_error (error, 1, 0, _("invalid option '%s', use a combination of [%s] or 'default' or 'none'"),
+ g_set_error (error, 1, 0, _("invalid option '%s', use a combination of [%s] or 'ignore', 'default' or 'none'"),
err_token,
nm_utils_enum_to_str (nm_setting_wired_wake_on_lan_get_type (),
NM_SETTING_WIRED_WAKE_ON_LAN_ALL));
@@ -1566,9 +1569,9 @@ nmc_property_wired_set_wake_on_lan (NMSetting *setting, const char *prop,
}
}
- if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT) &&
- NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_ALL)) {
- g_set_error_literal (error, 1, 0, _("'default' is incompatible with other flags"));
+ if ( NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS)
+ && !nm_utils_is_power_of_two (wol)) {
+ g_set_error_literal (error, 1, 0, _("'default' and 'ignore' are incompatible with other flags"));
return FALSE;
}
diff --git a/libnm-core/nm-setting-wired.c b/libnm-core/nm-setting-wired.c
index 3d0c5b6..c38b187 100644
--- a/libnm-core/nm-setting-wired.c
+++ b/libnm-core/nm-setting-wired.c
@@ -696,12 +696,12 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
- if ( NM_FLAGS_HAS (priv->wol, NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
- && NM_FLAGS_ANY (priv->wol, NM_SETTING_WIRED_WAKE_ON_LAN_ALL)) {
+ if ( NM_FLAGS_ANY (priv->wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS)
+ && !nm_utils_is_power_of_two (priv->wol)) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("Wake-on-LAN mode 'default' is incompatible with other flags"));
+ _("Wake-on-LAN mode 'default' and 'ignore' are exclusive flags"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_WIRED_WAKE_ON_LAN);
return FALSE;
}
@@ -1190,7 +1190,10 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class)
* May be any combination of %NM_SETTING_WIRED_WAKE_ON_LAN_PHY,
* %NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST, %NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST,
* %NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST, %NM_SETTING_WIRED_WAKE_ON_LAN_ARP,
- * %NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC.
+ * %NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC or the special values
+ * %NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT (to use global settings) and
+ * %NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE (to disable management of Wake-on-LAN in
+ * NetworkManager).
*
* Since: 1.0.6
**/
diff --git a/libnm-core/nm-setting-wired.h b/libnm-core/nm-setting-wired.h
index 44b7c4d..e1fd6f6 100644
--- a/libnm-core/nm-setting-wired.h
+++ b/libnm-core/nm-setting-wired.h
@@ -43,14 +43,19 @@ G_BEGIN_DECLS
/**
* NMSettingWiredWakeOnLan:
* @NM_SETTING_WIRED_WAKE_ON_LAN_NONE: Wake-on-LAN disabled
- * @NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT: Use the default value
* @NM_SETTING_WIRED_WAKE_ON_LAN_PHY: Wake on PHY activity
* @NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST: Wake on unicast messages
* @NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST: Wake on multicast messages
* @NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST: Wake on broadcast messages
* @NM_SETTING_WIRED_WAKE_ON_LAN_ARP: Wake on ARP
* @NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC: Wake on magic packet
- * @NM_SETTING_WIRED_WAKE_ON_LAN_ALL: Wake on all events
+ * @NM_SETTING_WIRED_WAKE_ON_LAN_ALL: Wake on all events. This does not
+ * include the exclusive flags @NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT or
+ * @NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE.
+ * @NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT: Use the default value
+ * @NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE: Don't change configured settings
+ * @NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS: Mask of flags that are
+ * incompatible with other flags
*
* Options for #NMSettingWired:wake-on-lan. Note that not all options
* are supported by all devices.
@@ -59,15 +64,19 @@ G_BEGIN_DECLS
*/
typedef enum { /*< flags >*/
NM_SETTING_WIRED_WAKE_ON_LAN_NONE = 0, /*< skip >*/
- NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT = (1 << 0),
NM_SETTING_WIRED_WAKE_ON_LAN_PHY = (1 << 1),
NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST = (1 << 2),
NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST = (1 << 3),
NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST = (1 << 4),
NM_SETTING_WIRED_WAKE_ON_LAN_ARP = (1 << 5),
NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC = (1 << 6),
- _NM_SETTING_WIRED_WAKE_ON_LAN_LAST, /*< skip >*/
- NM_SETTING_WIRED_WAKE_ON_LAN_ALL = (((_NM_SETTING_WIRED_WAKE_ON_LAN_LAST - 1) << 1) - 1 - NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT) /*< skip >*/
+
+ _NM_SETTING_WIRED_WAKE_ON_LAN_LAST_OPT, /*< skip >*/
+ NM_SETTING_WIRED_WAKE_ON_LAN_ALL = (((_NM_SETTING_WIRED_WAKE_ON_LAN_LAST_OPT - 1) << 1) - 1) - (1 << 0 /*DEFAULT*/), /*< skip >*/
+
+ NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT = (1 << 0),
+ NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE = (1 << 15),
+ NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT | NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE, /*< skip >*/
} NMSettingWiredWakeOnLan;
#define NM_SETTING_WIRED_PORT "port"
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index beb86e1..7c0de88 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -1195,15 +1195,22 @@ wake_on_lan_enable (NMDevice *device)
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,
- NM_SETTING_WIRED_WAKE_ON_LAN_ALL,
+ 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_NONE;
+ wol = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
found:
return nmp_utils_ethtool_set_wake_on_lan (nm_device_get_iface (device), wol, password);
}
diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c
index 051a873..e9b8d4b 100644
--- a/src/platform/nm-platform-utils.c
+++ b/src/platform/nm-platform-utils.c
@@ -279,6 +279,9 @@ nmp_utils_ethtool_set_wake_on_lan (const char *ifname,
{
struct ethtool_wolinfo wol_info = { };
+ if (wol == NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE)
+ return TRUE;
+
nm_log_dbg (LOGD_PLATFORM, "setting Wake-on-LAN options 0x%x, password '%s'",
(unsigned int) wol, wol_password);
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 5bba38f..845b139 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -3506,18 +3506,23 @@ wireless_connection_from_ifcfg (const char *file,
static void
parse_ethtool_options (shvarFile *ifcfg, NMSettingWired *s_wired, char *value)
{
- NMSettingWiredWakeOnLan wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
+ NMSettingWiredWakeOnLan wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
gboolean use_password = FALSE;
- char **words, **iter, *flag;
+ char **words = NULL, **iter = NULL, *flag;
- if (!value || !value[0])
+ if (!value)
return;
- words = g_strsplit_set (value, " ", 0);
- iter = words;
+ if (value[0]) {
+ words = g_strsplit_set (value, " ", 0);
+ iter = words;
+ }
- while (iter[0]) {
+ while (iter && iter[0]) {
if (g_str_equal (iter[0], "wol") && iter[1] && *iter[1]) {
+
+ wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
+
for (flag = iter[1]; *flag; flag++) {
switch (*flag) {
case 'p':
@@ -3553,7 +3558,6 @@ parse_ethtool_options (shvarFile *ifcfg, NMSettingWired *s_wired, char *value)
if (!NM_FLAGS_HAS (wol_flags, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC))
use_password = FALSE;
- g_object_set (s_wired, NM_SETTING_WIRED_WAKE_ON_LAN, wol_flags, NULL);
iter += 2;
continue;
}
@@ -3574,6 +3578,7 @@ parse_ethtool_options (shvarFile *ifcfg, NMSettingWired *s_wired, char *value)
iter++;
}
+ g_object_set (s_wired, NM_SETTING_WIRED_WAKE_ON_LAN, wol_flags, NULL);
g_strfreev (words);
}
@@ -3712,7 +3717,7 @@ make_wired_setting (shvarFile *ifcfg,
g_free (value);
}
- value = svGetValue (ifcfg, "ETHTOOL_OPTS", FALSE);
+ value = svGetValueFull (ifcfg, "ETHTOOL_OPTS", FALSE);
parse_ethtool_options (ifcfg, s_wired, value);
g_free (value);
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index 69b7d64..4f9498b 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -1137,7 +1137,9 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
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)
+ if (wol == NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE)
+ svSetValueFull (ifcfg, "ETHTOOL_OPTS", "", FALSE);
+ else if (wol == NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT)
svSetValue (ifcfg, "ETHTOOL_OPTS", NULL, FALSE);
else {
str = g_string_sized_new (30);
--
2.4.3
From 4bfa6ec3f2a5579d4898b656575df17681780075 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 24 Sep 2015 17:31:19 +0200
Subject: [PATCH 2/4] ifcfg-rh: improve parsing of Wake-on-LAN options
Initscripts do:
oldifs=$IFS;
IFS=';';
[ -n "${ETHTOOL_DELAY}" ] && /bin/usleep ${ETHTOOL_DELAY}
for opts in $ETHTOOL_OPTS ; do
IFS=$oldifs;
if [[ "${opts}" =~ [[:space:]]*- ]]; then
/sbin/ethtool $opts
else
/sbin/ethtool -s ${REALDEVICE} $opts
fi
IFS=';';
done
IFS=$oldifs;
thus, we want to split on ';', otherwise we parse
"wol d;something else"
wrong.
Also, g_strsplit_set() returns multiple empty tokens. So
we must skip over empty tokens in case of "wol d".
The @use_password was wrong, because we would warn if sopass is specified
before wol:
"sopass AA:BB:CC:DD:EE:FF wol g"
More resilently handle wrong configurations:
"wol pu wol m" => gives m.
"wol pu wol" => should give NONE and warn (instead of "pu").
Also accept tab as separator.
(cherry picked from commit bd1c0086bd17e8ff2852eec530d48dc3136e915b)
---
src/settings/plugins/ifcfg-rh/reader.c | 114 +++++++++++++++------
.../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 3 +-
2 files changed, 81 insertions(+), 36 deletions(-)
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 845b139..e45ad63 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -3504,26 +3504,49 @@ wireless_connection_from_ifcfg (const char *file,
}
static void
-parse_ethtool_options (shvarFile *ifcfg, NMSettingWired *s_wired, char *value)
+parse_ethtool_option (const char *value, NMSettingWiredWakeOnLan *out_flags, char **out_password)
{
- NMSettingWiredWakeOnLan wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
- gboolean use_password = FALSE;
- char **words = NULL, **iter = NULL, *flag;
+ gs_strfreev char **words = NULL;
+ const char **iter = NULL, *flag;
+ gboolean has_flags = FALSE;
+ gboolean has_password = FALSE;
- if (!value)
+ if (!value || !value[0])
return;
- if (value[0]) {
- words = g_strsplit_set (value, " ", 0);
- iter = words;
- }
+ words = g_strsplit_set (value, "\t ", 0);
+ iter = (const char **) words;
+
+ while (iter[0]) {
+ gboolean is_wol;
+
+ if (g_str_equal (iter[0], "wol"))
+ is_wol = TRUE;
+ else if (g_str_equal (iter[0], "sopass"))
+ is_wol = FALSE;
+ else {
+ /* Silently skip unknown options */
+ iter++;
+ continue;
+ }
+
+ iter++;
+
+ /* g_strsplit_set() returns empty tokens, meaning that we must skip over repeated
+ * space characters like to parse "wol d". */
+ while (iter[0] && !*iter[0])
+ iter++;
- while (iter && iter[0]) {
- if (g_str_equal (iter[0], "wol") && iter[1] && *iter[1]) {
+ if (is_wol) {
+ NMSettingWiredWakeOnLan wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
+ has_flags = TRUE;
- wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
+ if (!iter[0]) {
+ PARSE_WARNING ("Wake-on-LAN options missing");
+ break;
+ }
- for (flag = iter[1]; *flag; flag++) {
+ for (flag = iter[0]; *flag; flag++) {
switch (*flag) {
case 'p':
wol_flags |= NM_SETTING_WIRED_WAKE_ON_LAN_PHY;
@@ -3544,42 +3567,65 @@ parse_ethtool_options (shvarFile *ifcfg, NMSettingWired *s_wired, char *value)
wol_flags |= NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC;
break;
case 's':
- use_password = TRUE;
break;
case 'd':
wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
- use_password = FALSE;
break;
default:
PARSE_WARNING ("unrecognized Wake-on-LAN option '%c'", *flag);
}
}
- if (!NM_FLAGS_HAS (wol_flags, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC))
- use_password = FALSE;
+ *out_flags = wol_flags;
+ } else {
+ has_password = TRUE;
- iter += 2;
- continue;
- }
+ if (!iter[0]) {
+ PARSE_WARNING ("Wake-on-LAN password missing");
+ break;
+ }
- if (g_str_equal (iter[0], "sopass") && iter[1] && *iter[1]) {
- if (use_password) {
- if (nm_utils_hwaddr_valid (iter[1], ETH_ALEN))
- g_object_set (s_wired, NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD, iter[1], NULL);
- else
- PARSE_WARNING ("Wake-on-LAN password '%s' is invalid", iter[1]);
- } else
- PARSE_WARNING ("Wake-on-LAN password not expected");
- iter += 2;
- continue;
- }
- /* Silently skip unknown options */
+ g_clear_pointer (out_password, g_free);
+ if (nm_utils_hwaddr_valid (iter[0], ETH_ALEN))
+ *out_password = g_strdup (iter[0]);
+ else
+ PARSE_WARNING ("Wake-on-LAN password '%s' is invalid", iter[0]);
+ }
iter++;
}
+}
+
+static void
+parse_ethtool_options (shvarFile *ifcfg, NMSettingWired *s_wired, const char *value)
+{
+ NMSettingWiredWakeOnLan wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
+ gs_free char *wol_password = NULL;
+ gboolean ignore_wol_password = FALSE;
+
+ if (value) {
+ gs_strfreev char **opts = NULL;
+ const char **iter;
+
+ wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
+
+ opts = g_strsplit_set (value, ";", 0);
+ for (iter = (const char **) opts; iter[0]; iter++) {
+ /* in case of repeated wol_passwords, parse_ethtool_option()
+ * will do the right thing and clear wol_password before resetting. */
+ parse_ethtool_option (iter[0], &wol_flags, &wol_password);
+ }
+ }
- g_object_set (s_wired, NM_SETTING_WIRED_WAKE_ON_LAN, wol_flags, NULL);
- g_strfreev (words);
+ if ( wol_password
+ && !NM_FLAGS_HAS (wol_flags, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC)) {
+ PARSE_WARNING ("Wake-on-LAN password not expected");
+ ignore_wol_password = TRUE;
+ }
+ g_object_set (s_wired,
+ NM_SETTING_WIRED_WAKE_ON_LAN, wol_flags,
+ NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD, ignore_wol_password ? NULL : wol_password,
+ NULL);
}
static NMSetting *
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index f42dbf4..42a91d3 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -6122,8 +6122,7 @@ test_write_wired_static (void)
g_assert_cmpint (nm_setting_ip_config_get_route_metric (reread_s_ip4), ==, 204);
g_assert_cmpint (nm_setting_ip_config_get_route_metric (reread_s_ip6), ==, 206);
- ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE,
- "wired-static-write", "written and re-read connection weren't the same.");
+ nmtst_assert_connection_equals (connection, FALSE, reread, FALSE);
route6file = utils_get_route6_path (testfile);
unlink (route6file);
--
2.4.3
From 88b1515f3eaafa357763d827f4fbd1be302a7ec4 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 20 Oct 2015 17:39:35 +0200
Subject: [PATCH 3/4] ifcfg-rh: remove unused variable in
parse_ethtool_option()
(cherry picked from commit f840d9465f83ed1a5c559c2bd340068782c7d72e)
---
src/settings/plugins/ifcfg-rh/reader.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index e45ad63..90706b5 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -3509,7 +3509,6 @@ parse_ethtool_option (const char *value, NMSettingWiredWakeOnLan *out_flags, cha
gs_strfreev char **words = NULL;
const char **iter = NULL, *flag;
gboolean has_flags = FALSE;
- gboolean has_password = FALSE;
if (!value || !value[0])
return;
@@ -3578,14 +3577,11 @@ parse_ethtool_option (const char *value, NMSettingWiredWakeOnLan *out_flags, cha
*out_flags = wol_flags;
} else {
- has_password = TRUE;
-
if (!iter[0]) {
PARSE_WARNING ("Wake-on-LAN password missing");
break;
}
-
g_clear_pointer (out_password, g_free);
if (nm_utils_hwaddr_valid (iter[0], ETH_ALEN))
*out_password = g_strdup (iter[0]);
--
2.4.3
From 446320300b87105f65285d1b04643ee7c2583010 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 20 Oct 2015 17:42:59 +0200
Subject: [PATCH 4/4] ifcfg-rh: remove another unused variable in
parse_ethtool_option()
(cherry picked from commit 58fc4381ff718a009fe7eb72a42a9c22e0b0a56a)
---
src/settings/plugins/ifcfg-rh/reader.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 90706b5..a1b2813 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -3508,7 +3508,6 @@ parse_ethtool_option (const char *value, NMSettingWiredWakeOnLan *out_flags, cha
{
gs_strfreev char **words = NULL;
const char **iter = NULL, *flag;
- gboolean has_flags = FALSE;
if (!value || !value[0])
return;
@@ -3538,7 +3537,6 @@ parse_ethtool_option (const char *value, NMSettingWiredWakeOnLan *out_flags, cha
if (is_wol) {
NMSettingWiredWakeOnLan wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
- has_flags = TRUE;
if (!iter[0]) {
PARSE_WARNING ("Wake-on-LAN options missing");
--
2.4.3