diff options
author | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2023-03-27 10:57:27 +0200 |
---|---|---|
committer | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2023-03-28 12:50:27 +0200 |
commit | 2b0870ed28200752c4a6ca67bd60b58186bbac27 (patch) | |
tree | 66c669b2c3ab96fd1a239e8197d2a02398da9b21 | |
parent | afd1a7b9a6284c61073881e6a0a9fbaa6b409b1f (diff) | |
download | NetworkManager-2b0870ed28200752c4a6ca67bd60b58186bbac27.tar.gz |
bonding: fix verification of ns_ip6_target and arp_validate options
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.c | 35 |
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); |