summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Cardace <acardace@redhat.com>2020-02-21 11:43:41 +0100
committerAntonio Cardace <acardace@redhat.com>2020-03-06 10:39:00 +0100
commit57bdf68088a8b4f5f5799ebcec97dfbb3d45fbab (patch)
treea58dc043089ce8b416d05c9b3846bc27a3d46ff5
parentc07f3b518c42397e452125bcd2d73e3a8459fef6 (diff)
downloadNetworkManager-57bdf68088a8b4f5f5799ebcec97dfbb3d45fbab.tar.gz
nm-setting-bond: let 'miimon' and 'arp_interval' coexist for verify()
Fix 'miimon' and 'arp_interval' validation, they can both be set indeed, the kernel does not impose this limitation, nevertheless is sensible to keep the defaults as previously (miimon=100, arp_interval=0). Also add unit test.
-rw-r--r--libnm-core/nm-setting-bond.c11
-rw-r--r--libnm-core/tests/test-setting.c10
2 files changed, 10 insertions, 11 deletions
diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c
index 0d62ff3e65..b3c196a95d 100644
--- a/libnm-core/nm-setting-bond.c
+++ b/libnm-core/nm-setting-bond.c
@@ -661,17 +661,6 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
num_grat_arp = _atoi (bond_get_option_or_default (self, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP));
num_unsol_na = _atoi (bond_get_option_or_default (self, NM_SETTING_BOND_OPTION_NUM_UNSOL_NA));
- /* Can only set one of miimon and arp_interval */
- if (miimon > 0 && arp_interval > 0) {
- g_set_error (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("only one of '%s' and '%s' can be set"),
- NM_SETTING_BOND_OPTION_MIIMON,
- NM_SETTING_BOND_OPTION_ARP_INTERVAL);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
- return FALSE;
- }
/* Verify bond mode */
mode_orig = g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_MODE);
diff --git a/libnm-core/tests/test-setting.c b/libnm-core/tests/test-setting.c
index 9809ef39dd..71f484bab5 100644
--- a/libnm-core/tests/test-setting.c
+++ b/libnm-core/tests/test-setting.c
@@ -595,6 +595,16 @@ test_bond_verify (void)
"mode", "0",
"downdelay", "0",
"updelay", "0");
+ test_verify_options (TRUE,
+ "mode", "0",
+ "miimon", "100",
+ "arp_ip_target", "1.1.1.1",
+ "arp_interval", "200");
+ test_verify_options (TRUE,
+ "mode", "0",
+ "downdelay", "100",
+ "arp_ip_target", "1.1.1.1",
+ "arp_interval", "200");
}
static void