diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-12-17 14:29:24 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-01-13 09:35:49 +0100 |
commit | 93438dd0923fb2ca9dc6ae77a4937d1acd748fa5 (patch) | |
tree | 1a985aea7464f0d062ad7411bfec98523d1bb4bd | |
parent | d787f0391bced0382bef398f07c3dea164b5a291 (diff) | |
download | NetworkManager-93438dd0923fb2ca9dc6ae77a4937d1acd748fa5.tar.gz |
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
-rw-r--r-- | libnm-core/nm-setting-bond.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c index bb05312539..9cea9d6a82 100644 --- a/libnm-core/nm-setting-bond.c +++ b/libnm-core/nm-setting-bond.c @@ -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 |