summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando Fernandez Mancera <ffmancera@riseup.net>2023-03-01 15:12:35 +0000
committerFernando Fernandez Mancera <ffmancera@riseup.net>2023-03-06 15:04:54 +0100
commitddd2fd46b022f87589ae4b1cde61f93576231e9d (patch)
treef5c76654b112495bc028dfa9065029a78465c7dc
parent8dd18d91b2c74f43ca2467245f78815bc4df5249 (diff)
bonding: add support to arp_missed_max option
The new arp_missed_max option valid range is 0-255 where value 0 means not set. Please notice that this option is not compatible with 802.3AD, balance-tlb and balance-alb modes.
-rw-r--r--src/core/devices/nm-device-bond.c6
-rw-r--r--src/libnm-core-impl/nm-setting-bond.c17
-rw-r--r--src/libnm-core-impl/tests/test-setting.c1
-rw-r--r--src/libnm-core-public/nm-setting-bond.h1
-rw-r--r--src/libnm-platform/nm-linux-platform.c6
-rw-r--r--src/libnm-platform/nm-platform.c4
-rw-r--r--src/libnm-platform/nm-platform.h1
7 files changed, 34 insertions, 2 deletions
diff --git a/src/core/devices/nm-device-bond.c b/src/core/devices/nm-device-bond.c
index 0b0697e3c5..1e65fa45b0 100644
--- a/src/core/devices/nm-device-bond.c
+++ b/src/core/devices/nm-device-bond.c
@@ -39,7 +39,8 @@
NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, NM_SETTING_BOND_OPTION_PRIMARY_RESELECT, \
NM_SETTING_BOND_OPTION_RESEND_IGMP, NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB, \
NM_SETTING_BOND_OPTION_USE_CARRIER, NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, \
- NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY
+ NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY, \
+ NM_SETTING_BOND_OPTION_ARP_MISSED_MAX
#define OPTIONS_REAPPLY_SUBSET \
NM_SETTING_BOND_OPTION_MIIMON, NM_SETTING_BOND_OPTION_UPDELAY, \
@@ -51,7 +52,7 @@
NM_SETTING_BOND_OPTION_PACKETS_PER_SLAVE, NM_SETTING_BOND_OPTION_PRIMARY_RESELECT, \
NM_SETTING_BOND_OPTION_RESEND_IGMP, NM_SETTING_BOND_OPTION_USE_CARRIER, \
NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, \
- NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY
+ NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX
#define OPTIONS_REAPPLY_FULL \
OPTIONS_REAPPLY_SUBSET, NM_SETTING_BOND_OPTION_ACTIVE_SLAVE, \
@@ -437,6 +438,7 @@ _platform_lnk_bond_init_from_setting(NMSettingBond *s_bond, NMPlatformLnkBond *p
NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY),
.num_grat_arp = _v_u8(s_bond, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP),
.all_ports_active = _v_u8(s_bond, NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE),
+ .arp_missed_max = _v_u8(s_bond, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX),
.lacp_rate = _v_fcn(_nm_setting_bond_lacp_rate_from_string,
s_bond,
NM_SETTING_BOND_OPTION_LACP_RATE),
diff --git a/src/libnm-core-impl/nm-setting-bond.c b/src/libnm-core-impl/nm-setting-bond.c
index 54030e0b4f..cc65598fab 100644
--- a/src/libnm-core-impl/nm-setting-bond.c
+++ b/src/libnm-core-impl/nm-setting-bond.c
@@ -92,6 +92,7 @@ static const char *const valid_options_lst[] = {
NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB,
NM_SETTING_BOND_OPTION_LP_INTERVAL,
NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY,
+ NM_SETTING_BOND_OPTION_ARP_MISSED_MAX,
NULL,
};
@@ -194,6 +195,7 @@ static NM_UTILS_STRING_TABLE_LOOKUP_STRUCT_DEFINE(
{"any", NM_BOND_OPTION_TYPE_BOTH, 0, 1, _option_default_strv_arp_all_targets}},
{NM_SETTING_BOND_OPTION_ARP_INTERVAL, {"0", NM_BOND_OPTION_TYPE_INT, 0, G_MAXINT}},
{NM_SETTING_BOND_OPTION_ARP_IP_TARGET, {"", NM_BOND_OPTION_TYPE_IP}},
+ {NM_SETTING_BOND_OPTION_ARP_MISSED_MAX, {"0", NM_BOND_OPTION_TYPE_INT, 0, 255}},
{NM_SETTING_BOND_OPTION_ARP_VALIDATE,
{"none", NM_BOND_OPTION_TYPE_BOTH, 0, 6, _option_default_strv_arp_validate}},
{NM_SETTING_BOND_OPTION_BALANCE_SLB, {"0", NM_BOND_OPTION_TYPE_INT, 0, 1}},
@@ -846,6 +848,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
NMSettingBondPrivate *priv = NM_SETTING_BOND_GET_PRIVATE(setting);
int miimon;
int arp_interval;
+ int arp_missed_max;
int num_grat_arp;
int num_unsol_na;
int peer_notif_delay;
@@ -876,6 +879,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
miimon = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_MIIMON));
arp_interval = _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_ARP_INTERVAL));
+ arp_missed_max =
+ _atoi(_bond_get_option_or_default(self, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX));
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));
peer_notif_delay =
@@ -886,6 +891,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
* arp_interval conflicts [ alb, tlb ]
* arp_interval needs arp_ip_target
* arp_validate does not work with [ BOND_MODE_8023AD, BOND_MODE_TLB, BOND_MODE_ALB ]
+ * arp_missed_max does not work with [ BOND_MODE_8023AD, BOND_MODE_TLB, BOND_MODE_ALB ]
* downdelay needs miimon
* updelay needs miimon
* peer_notif_delay needs miimon enabled
@@ -929,6 +935,17 @@ 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 (arp_missed_max > 0) {
+ g_set_error(error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("'%s=%s' is incompatible with '%s > 0'"),
+ NM_SETTING_BOND_OPTION_MODE,
+ mode_str,
+ NM_SETTING_BOND_OPTION_ARP_MISSED_MAX);
+ g_prefix_error(error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS);
+ return FALSE;
+ }
}
primary = _bond_get_option(self, NM_SETTING_BOND_OPTION_PRIMARY);
diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c
index 46e6818125..b30758ffab 100644
--- a/src/libnm-core-impl/tests/test-setting.c
+++ b/src/libnm-core-impl/tests/test-setting.c
@@ -5259,6 +5259,7 @@ test_bond_meta(void)
_A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_ACTOR_SYS_PRIO, 0, EINVAL);
_A(_nm_setting_bond_opt_value_as_u16, set, NM_SETTING_BOND_OPTION_AD_USER_PORT_KEY, 0, EINVAL);
_A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_NUM_GRAT_ARP, 1, 0);
+ _A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_ARP_MISSED_MAX, 0, 0);
_A(_nm_setting_bond_opt_value_as_u8, set, NM_SETTING_BOND_OPTION_ALL_SLAVES_ACTIVE, 0, 0);
_A(_nm_setting_bond_opt_value_as_intbool, set, NM_SETTING_BOND_OPTION_USE_CARRIER, 1, 0);
_A(_nm_setting_bond_opt_value_as_intbool,
diff --git a/src/libnm-core-public/nm-setting-bond.h b/src/libnm-core-public/nm-setting-bond.h
index 10d703bcaa..16e11f0151 100644
--- a/src/libnm-core-public/nm-setting-bond.h
+++ b/src/libnm-core-public/nm-setting-bond.h
@@ -58,6 +58,7 @@ G_BEGIN_DECLS
#define NM_SETTING_BOND_OPTION_TLB_DYNAMIC_LB "tlb_dynamic_lb"
#define NM_SETTING_BOND_OPTION_LP_INTERVAL "lp_interval"
#define NM_SETTING_BOND_OPTION_PEER_NOTIF_DELAY "peer_notif_delay"
+#define NM_SETTING_BOND_OPTION_ARP_MISSED_MAX "arp_missed_max"
typedef struct _NMSettingBondClass NMSettingBondClass;
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c
index 94e92a9bec..2b26494663 100644
--- a/src/libnm-platform/nm-linux-platform.c
+++ b/src/libnm-platform/nm-linux-platform.c
@@ -180,6 +180,7 @@ G_STATIC_ASSERT(RTA_MAX == (__RTA_MAX - 1));
/*****************************************************************************/
#define IFLA_BOND_PEER_NOTIF_DELAY 28
+#define IFLA_BOND_MISSED_MAX 30
#undef IFLA_BOND_MAX
@@ -1606,6 +1607,7 @@ _parse_lnk_bond(const char *kind, struct nlattr *info_data)
[IFLA_BOND_AD_ACTOR_SYSTEM] = {.minlen = sizeof(NMEtherAddr)},
[IFLA_BOND_TLB_DYNAMIC_LB] = {.type = NLA_U8},
[IFLA_BOND_PEER_NOTIF_DELAY] = {.type = NLA_U32},
+ [IFLA_BOND_MISSED_MAX] = {.type = NLA_U8},
};
NMPlatformLnkBond *props;
struct nlattr *tb[G_N_ELEMENTS(policy)];
@@ -1680,6 +1682,8 @@ _parse_lnk_bond(const char *kind, struct nlattr *info_data)
props->num_grat_arp = nla_get_u8(tb[IFLA_BOND_NUM_PEER_NOTIF]);
if (tb[IFLA_BOND_ALL_SLAVES_ACTIVE])
props->all_ports_active = nla_get_u8(tb[IFLA_BOND_ALL_SLAVES_ACTIVE]);
+ if (tb[IFLA_BOND_MISSED_MAX])
+ props->arp_missed_max = nla_get_u8(tb[IFLA_BOND_MISSED_MAX]);
if (tb[IFLA_BOND_MIN_LINKS])
props->min_links = nla_get_u32(tb[IFLA_BOND_MIN_LINKS]);
if (tb[IFLA_BOND_LP_INTERVAL])
@@ -4734,6 +4738,8 @@ _nl_msg_new_link_set_linkinfo(struct nl_msg *msg, NMLinkType link_type, gconstpo
&props->ad_actor_system);
if (props->ad_select)
NLA_PUT_U8(msg, IFLA_BOND_AD_SELECT, props->ad_select);
+ if (props->arp_missed_max)
+ NLA_PUT_U8(msg, IFLA_BOND_MISSED_MAX, props->arp_missed_max);
NLA_PUT_U8(msg, IFLA_BOND_ALL_SLAVES_ACTIVE, props->all_ports_active);
diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c
index 42b90a83fa..8692453efa 100644
--- a/src/libnm-platform/nm-platform.c
+++ b/src/libnm-platform/nm-platform.c
@@ -6221,6 +6221,7 @@ nm_platform_lnk_bond_to_string(const NMPlatformLnkBond *lnk, char *buf, gsize le
" xmit_hash_policy %u"
" num_gray_arp %u"
" all_ports_active %u"
+ " arp_missed_max %u"
" lacp_rate %u"
" ad_select %u"
" use_carrier %d"
@@ -6271,6 +6272,7 @@ nm_platform_lnk_bond_to_string(const NMPlatformLnkBond *lnk, char *buf, gsize le
lnk->xmit_hash_policy,
lnk->num_grat_arp,
lnk->all_ports_active,
+ lnk->arp_missed_max,
lnk->lacp_rate,
lnk->ad_select,
(int) lnk->use_carrier,
@@ -8037,6 +8039,7 @@ nm_platform_lnk_bond_hash_update(const NMPlatformLnkBond *obj, NMHashState *h)
obj->ad_actor_system,
obj->ad_select,
obj->all_ports_active,
+ obj->arp_missed_max,
obj->arp_ip_targets_num,
obj->fail_over_mac,
obj->lacp_rate,
@@ -8084,6 +8087,7 @@ nm_platform_lnk_bond_cmp(const NMPlatformLnkBond *a, const NMPlatformLnkBond *b)
NM_CMP_FIELD_MEMCMP(a, b, ad_actor_system);
NM_CMP_FIELD(a, b, ad_select);
NM_CMP_FIELD(a, b, all_ports_active);
+ NM_CMP_FIELD(a, b, arp_missed_max);
NM_CMP_FIELD(a, b, fail_over_mac);
NM_CMP_FIELD(a, b, lacp_rate);
NM_CMP_FIELD(a, b, num_grat_arp);
diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h
index d816513cd0..f4202f25ab 100644
--- a/src/libnm-platform/nm-platform.h
+++ b/src/libnm-platform/nm-platform.h
@@ -782,6 +782,7 @@ typedef struct {
NMEtherAddr ad_actor_system;
guint8 ad_select;
guint8 all_ports_active;
+ guint8 arp_missed_max;
guint8 arp_ip_targets_num;
guint8 fail_over_mac;
guint8 lacp_rate;