Commit 93438dd0 authored by Jiří Klimeš's avatar Jiří Klimeš

libnm-core: accept numeric bond modes (bgo #704666) (rh #1133544)

https://bugzilla.gnome.org/show_bug.cgi?id=704666
https://bugzilla.redhat.com/show_bug.cgi?id=1133544
parent d787f039
......@@ -440,15 +440,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
NMSettingBondPrivate *priv = NM_SETTING_BOND_GET_PRIVATE (setting);
GHashTableIter iter;
const char *key, *value;
const char *valid_modes[] = { "balance-rr",
"active-backup",
"balance-xor",
"broadcast",
"802.3ad",
"balance-tlb",
"balance-alb",
NULL };
int miimon = 0, arp_interval = 0;
int mode, miimon = 0, arp_interval = 0;
const char *arp_ip_target = NULL;
const char *lacp_rate;
const char *primary;
......@@ -484,6 +476,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
}
/* Verify bond mode */
value = g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_MODE);
if (!value) {
g_set_error (error,
......@@ -494,7 +487,8 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
return FALSE;
}
if (!_nm_utils_string_in_list (value, valid_modes)) {
mode = nm_utils_bond_mode_string_to_int (value);
if (mode == -1) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
......@@ -503,6 +497,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
return FALSE;
}
value = nm_utils_bond_mode_int_to_string (mode);
/* Make sure mode is compatible with other settings */
if ( strcmp (value, "balance-alb") == 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment