summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando Fernandez Mancera <ffmancera@riseup.net>2023-03-27 10:57:27 +0200
committerFernando Fernandez Mancera <ffmancera@riseup.net>2023-03-27 11:51:40 +0200
commitcbbfb0530624e8ba0730aea32837d95405e462f0 (patch)
treecfed0ba6aada21bb08af8aa601ce7421cb0ff88f
parent5d28a0dd899bbe24f805758283173927c530291c (diff)
bonding: fix verification of ns_ip6_target and arp_validate optionsff/fix_ns_ip6_target
When arp_validate is set it requires ns_ip6_target or arp_ip_target options to be set. Fixes: c6487c240c43 ('bonding: add support to ns_ip6_target option')
-rw-r--r--src/libnm-core-impl/nm-setting-bond.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/libnm-core-impl/nm-setting-bond.c b/src/libnm-core-impl/nm-setting-bond.c
index 06a53e4a22..81c67d51e0 100644
--- a/src/libnm-core-impl/nm-setting-bond.c
+++ b/src/libnm-core-impl/nm-setting-bond.c
@@ -1062,18 +1062,20 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
}
}
- /* arp_ip_target can only be used with arp_interval, and must
+ /* arp_ip_target and ns_ip6_target can only be used with arp_interval, and must
* contain a comma-separated list of IPv4 addresses.
*/
+ ns_ip6_target = _bond_get_option(self, NM_SETTING_BOND_OPTION_NS_IP6_TARGET);
arp_ip_target = _bond_get_option(self, NM_SETTING_BOND_OPTION_ARP_IP_TARGET);
if (arp_interval > 0) {
- if (!arp_ip_target) {
+ if (!arp_ip_target && !ns_ip6_target) {
g_set_error(error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("'%s' option requires '%s' option to be set"),
+ _("'%s' option requires '%s' or '%s'option to be set"),
NM_SETTING_BOND_OPTION_ARP_INTERVAL,
- NM_SETTING_BOND_OPTION_ARP_IP_TARGET);
+ NM_SETTING_BOND_OPTION_ARP_IP_TARGET,
+ NM_SETTING_BOND_OPTION_NS_IP6_TARGET);
g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
return FALSE;
}
@@ -1088,21 +1090,16 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
return FALSE;
}
- }
-
- /* ns_ip6_target can only be used with arp_interval, and must
- * contain a comma-separated list of IPv6 addresses.
- */
- ns_ip6_target = _bond_get_option(self, NM_SETTING_BOND_OPTION_NS_IP6_TARGET);
- if (ns_ip6_target && arp_interval == 0) {
- g_set_error(error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("'%s' option requires '%s' option to be set"),
- NM_SETTING_BOND_OPTION_NS_IP6_TARGET,
- NM_SETTING_BOND_OPTION_ARP_INTERVAL);
- g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
- return FALSE;
+ if (ns_ip6_target) {
+ g_set_error(error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("'%s' option requires '%s' option to be set"),
+ NM_SETTING_BOND_OPTION_NS_IP6_TARGET,
+ NM_SETTING_BOND_OPTION_ARP_INTERVAL);
+ g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
+ return FALSE;
+ }
}
lacp_rate = _bond_get_option(self, NM_SETTING_BOND_OPTION_LACP_RATE);