mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 05:00:15 +01:00
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.
This commit is contained in:
parent
8dd18d91b2
commit
ddd2fd46b0
7 changed files with 34 additions and 2 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue