summaryrefslogtreecommitdiff
path: root/libnm-util/nm-setting-bond.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2012-03-22 12:39:16 -0400
committerDan Winship <danw@gnome.org>2012-03-22 13:12:57 -0400
commit131b43405405bac2c3d2bd39f84774888841249c (patch)
tree95396ad83df77039cd923a8ff0f8d237e73016e5 /libnm-util/nm-setting-bond.c
parent4ad810fdf4a37d7d0fa97beca2f08a7b0734499e (diff)
downloadNetworkManager-131b43405405bac2c3d2bd39f84774888841249c.tar.gz
libnm-util: fix an NMSettingBond bug
NMSettingBond sets the "miimon" option to "100" by default, but this means that when reading in a saved configuration with "arp_interval" set, it would end up with both "miimon" and "arp_interval" set, which is invalid. Fix this by clearing "miimon" if "arp_interval" is set, and vice versa.
Diffstat (limited to 'libnm-util/nm-setting-bond.c')
-rw-r--r--libnm-util/nm-setting-bond.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libnm-util/nm-setting-bond.c b/libnm-util/nm-setting-bond.c
index 50cad2da7a..0e9bb0f452 100644
--- a/libnm-util/nm-setting-bond.c
+++ b/libnm-util/nm-setting-bond.c
@@ -237,17 +237,26 @@ gboolean nm_setting_bond_add_option (NMSettingBond *setting,
const char *name,
const char *value)
{
+ NMSettingBondPrivate *priv;
size_t value_len;
g_return_val_if_fail (NM_IS_SETTING_BOND (setting), FALSE);
g_return_val_if_fail (validate_option (name), FALSE);
g_return_val_if_fail (value != NULL, FALSE);
+ priv = NM_SETTING_BOND_GET_PRIVATE (setting);
+
value_len = strlen (value);
g_return_val_if_fail (value_len > 0 && value_len < 200, FALSE);
- g_hash_table_insert (NM_SETTING_BOND_GET_PRIVATE (setting)->options,
- g_strdup (name), g_strdup (value));
+ g_hash_table_insert (priv->options, g_strdup (name), g_strdup (value));
+
+ if (!strcmp (name, NM_SETTING_BOND_OPTION_MIIMON)) {
+ g_hash_table_remove (priv->options, NM_SETTING_BOND_OPTION_ARP_INTERVAL);
+ g_hash_table_remove (priv->options, NM_SETTING_BOND_OPTION_ARP_IP_TARGET);
+ } else if (!strcmp (name, NM_SETTING_BOND_OPTION_ARP_INTERVAL))
+ g_hash_table_remove (priv->options, NM_SETTING_BOND_OPTION_MIIMON);
+
return TRUE;
}