|
|
c48088 |
From 01d1f64ad408947fbeaebbf2768828504044377f Mon Sep 17 00:00:00 2001
|
|
|
c48088 |
From: Francesco Giudici <fgiudici@redhat.com>
|
|
|
c48088 |
Date: Mon, 5 Feb 2018 17:50:33 +0100
|
|
|
c48088 |
Subject: [PATCH 1/2] nmcli: team: clear runner-tx-hash before adding new
|
|
|
c48088 |
hashes
|
|
|
c48088 |
|
|
|
c48088 |
https://bugzilla.redhat.com/show_bug.cgi?id=1541922
|
|
|
c48088 |
(cherry picked from commit 350dbb55abf3a80267c398e6f64c2cee4645475a)
|
|
|
c48088 |
---
|
|
|
c48088 |
clients/common/nm-meta-setting-desc.c | 3 +++
|
|
|
c48088 |
1 file changed, 3 insertions(+)
|
|
|
c48088 |
|
|
|
c48088 |
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
|
|
|
c48088 |
index d829fa7d4..85b272cbc 100644
|
|
|
c48088 |
--- a/clients/common/nm-meta-setting-desc.c
|
|
|
c48088 |
+++ b/clients/common/nm-meta-setting-desc.c
|
|
|
c48088 |
@@ -3976,6 +3976,9 @@ _set_fcn_team_runner_tx_hash (ARGS_SET_FCN)
|
|
|
c48088 |
return FALSE;
|
|
|
c48088 |
}
|
|
|
c48088 |
|
|
|
c48088 |
+ while (nm_setting_team_get_num_runner_tx_hash (NM_SETTING_TEAM (setting)))
|
|
|
c48088 |
+ nm_setting_team_remove_runner_tx_hash (NM_SETTING_TEAM (setting), 0);
|
|
|
c48088 |
+
|
|
|
c48088 |
while (strv && strv[i])
|
|
|
c48088 |
nm_setting_team_add_runner_tx_hash (NM_SETTING_TEAM (setting), strv[i++]);
|
|
|
c48088 |
g_strfreev (strv);
|
|
|
c48088 |
--
|
|
|
c48088 |
2.14.3
|
|
|
c48088 |
|
|
|
c48088 |
|
|
|
c48088 |
From 11f0ca1f23e000e7cbd246a176d8470c8b6ee8a6 Mon Sep 17 00:00:00 2001
|
|
|
c48088 |
From: Francesco Giudici <fgiudici@redhat.com>
|
|
|
c48088 |
Date: Tue, 6 Feb 2018 16:44:11 +0100
|
|
|
c48088 |
Subject: [PATCH 2/2] nmcli: team: do strict checking on runner-tx-hashes
|
|
|
c48088 |
|
|
|
c48088 |
Substrings matching the heading of valid values were allowed if not
|
|
|
c48088 |
ambiguous (e.g.: "et" for "eth"). Moreover, upper case variants were
|
|
|
c48088 |
accepted too.
|
|
|
c48088 |
Do a plain string comparison check against the valid values.
|
|
|
c48088 |
Improve also the error message: give a list of valid tx-hashes.
|
|
|
c48088 |
|
|
|
c48088 |
(cherry picked from commit fd5b3f802ec204392ada9ee9b75978059323fab4)
|
|
|
c48088 |
---
|
|
|
c48088 |
clients/common/nm-meta-setting-desc.c | 31 +++++++++++++++++++------------
|
|
|
c48088 |
1 file changed, 19 insertions(+), 12 deletions(-)
|
|
|
c48088 |
|
|
|
c48088 |
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
|
|
|
c48088 |
index 85b272cbc..94404e908 100644
|
|
|
c48088 |
--- a/clients/common/nm-meta-setting-desc.c
|
|
|
c48088 |
+++ b/clients/common/nm-meta-setting-desc.c
|
|
|
c48088 |
@@ -3950,12 +3950,19 @@ _validate_fcn_team_config (const char *value, char **out_to_free, GError **error
|
|
|
c48088 |
}
|
|
|
c48088 |
|
|
|
c48088 |
static gboolean
|
|
|
c48088 |
-_is_valid_team_runner_tx_hash_element (const char *tx_hash_element)
|
|
|
c48088 |
+_is_valid_team_runner_tx_hash_element (const char *tx_hash_element,
|
|
|
c48088 |
+ GError **error)
|
|
|
c48088 |
{
|
|
|
c48088 |
- const char *valid_tx_hashes[] = { "eth", "vlan", "ipv4", "ipv6", "ip",
|
|
|
c48088 |
- "l3", "tcp", "udp", "sctp", "l4", NULL };
|
|
|
c48088 |
- if (nmc_string_is_valid (tx_hash_element, valid_tx_hashes, NULL))
|
|
|
c48088 |
+ nm_assert (!error || !*error);
|
|
|
c48088 |
+
|
|
|
c48088 |
+ if (NM_IN_STRSET (tx_hash_element,
|
|
|
c48088 |
+ "eth", "vlan", "ipv4", "ipv6", "ip",
|
|
|
c48088 |
+ "l3", "tcp", "udp", "sctp", "l4")) {
|
|
|
c48088 |
return TRUE;
|
|
|
c48088 |
+ }
|
|
|
c48088 |
+
|
|
|
c48088 |
+ g_set_error (error, 1, 0, "'%s' is not valid. %s", tx_hash_element,
|
|
|
c48088 |
+ "Valid tx-hashes: [eth, vlan, ipv4, ipv6, ip, l3, tcp, udp, sctp, l4]");
|
|
|
c48088 |
return FALSE;
|
|
|
c48088 |
}
|
|
|
c48088 |
|
|
|
c48088 |
@@ -3963,24 +3970,24 @@ static gboolean
|
|
|
c48088 |
_set_fcn_team_runner_tx_hash (ARGS_SET_FCN)
|
|
|
c48088 |
{
|
|
|
c48088 |
char **strv = NULL;
|
|
|
c48088 |
- guint i = 0;
|
|
|
c48088 |
+ char *const*iter;
|
|
|
c48088 |
|
|
|
c48088 |
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
|
|
c48088 |
|
|
|
c48088 |
strv = _nm_utils_strv_cleanup (g_strsplit_set (value, " \t,", 0),
|
|
|
c48088 |
TRUE, TRUE, TRUE);
|
|
|
c48088 |
- if (!verify_string_list (strv, property_info->property_name,
|
|
|
c48088 |
- _is_valid_team_runner_tx_hash_element,
|
|
|
c48088 |
- error)) {
|
|
|
c48088 |
- g_strfreev (strv);
|
|
|
c48088 |
- return FALSE;
|
|
|
c48088 |
+ for (iter = strv; strv && *iter; iter++) {
|
|
|
c48088 |
+ if (!_is_valid_team_runner_tx_hash_element (*iter, error)) {
|
|
|
c48088 |
+ g_strfreev (strv);
|
|
|
c48088 |
+ return FALSE;
|
|
|
c48088 |
+ }
|
|
|
c48088 |
}
|
|
|
c48088 |
|
|
|
c48088 |
while (nm_setting_team_get_num_runner_tx_hash (NM_SETTING_TEAM (setting)))
|
|
|
c48088 |
nm_setting_team_remove_runner_tx_hash (NM_SETTING_TEAM (setting), 0);
|
|
|
c48088 |
|
|
|
c48088 |
- while (strv && strv[i])
|
|
|
c48088 |
- nm_setting_team_add_runner_tx_hash (NM_SETTING_TEAM (setting), strv[i++]);
|
|
|
c48088 |
+ for (iter = strv; strv && *iter; iter++)
|
|
|
c48088 |
+ nm_setting_team_add_runner_tx_hash (NM_SETTING_TEAM (setting), *iter);
|
|
|
c48088 |
g_strfreev (strv);
|
|
|
c48088 |
|
|
|
c48088 |
return TRUE;
|
|
|
c48088 |
--
|
|
|
c48088 |
2.14.3
|
|
|
c48088 |
|