From: Susant Sahani Date: Thu, 15 Feb 2024 10:41:22 +0000 (+0530) Subject: network: netdev - bond add support for ARP missed max X-Git-Tag: v256-rc1~831^2~1 X-Git-Url: http://git-history.diyao.me/?a=commitdiff_plain;h=b33bba043480934642e2135c0846cedfd823c00b;p=systemd%2F.git network: netdev - bond add support for ARP missed max Allows to configure bond arp_missed_max is the maximum number of arp_interval monitor cycle for missed ARP replies. If this number is exceeded, link is reported as down. --- diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index bf3b5c21da..08da75f06f 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -2420,6 +2420,18 @@ + + + ARPMissedMax= + + Specify the maximum number of arp interval monitor cycle + for missed ARP replies. If this number is exceeded, link is reported as + down. Defaults to unset. + + + + + For more detail information see diff --git a/src/libsystemd/sd-netlink/netlink-types-rtnl.c b/src/libsystemd/sd-netlink/netlink-types-rtnl.c index 681b3086d0..1fa88b1ca5 100644 --- a/src/libsystemd/sd-netlink/netlink-types-rtnl.c +++ b/src/libsystemd/sd-netlink/netlink-types-rtnl.c @@ -124,6 +124,7 @@ static const NLAPolicy rtnl_link_info_data_bond_policies[] = { [IFLA_BOND_AD_ACTOR_SYSTEM] = BUILD_POLICY_WITH_SIZE(ETHER_ADDR, ETH_ALEN), [IFLA_BOND_TLB_DYNAMIC_LB] = BUILD_POLICY(U8), [IFLA_BOND_PEER_NOTIF_DELAY] = BUILD_POLICY(U32), + [IFLA_BOND_MISSED_MAX] = BUILD_POLICY(U8), }; static const NLAPolicy rtnl_link_info_data_bridge_policies[] = { diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c index 4d75a0d6bf..ecf091356b 100644 --- a/src/network/netdev/bond.c +++ b/src/network/netdev/bond.c @@ -198,6 +198,12 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin return r; } + if (b->arp_missed_max > 0) { + r = sd_netlink_message_append_u8(m, IFLA_BOND_MISSED_MAX, b->arp_missed_max); + if (r < 0) + return r; + } + if (b->arp_interval > 0 && !ordered_set_isempty(b->arp_ip_targets)) { void *val; int n = 0; diff --git a/src/network/netdev/bond.h b/src/network/netdev/bond.h index e4b0a0d94d..b301fa67f0 100644 --- a/src/network/netdev/bond.h +++ b/src/network/netdev/bond.h @@ -34,6 +34,8 @@ typedef struct Bond { uint16_t ad_user_port_key; struct ether_addr ad_actor_system; + uint8_t arp_missed_max; + usec_t miimon; usec_t updelay; usec_t downdelay; diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index d5aa522de8..eb28b9be54 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -218,6 +218,7 @@ Bond.LearnPacketIntervalSec, config_parse_sec, Bond.AdActorSystemPriority, config_parse_ad_actor_sys_prio, 0, offsetof(Bond, ad_actor_sys_prio) Bond.AdUserPortKey, config_parse_ad_user_port_key, 0, offsetof(Bond, ad_user_port_key) Bond.AdActorSystem, config_parse_ad_actor_system, 0, offsetof(Bond, ad_actor_system) +Bond.ARPMissedMax, config_parse_uint8, 0, offsetof(Bond, arp_missed_max) Bridge.HelloTimeSec, config_parse_sec, 0, offsetof(Bridge, hello_time) Bridge.MaxAgeSec, config_parse_sec, 0, offsetof(Bridge, max_age) Bridge.AgeingTimeSec, config_parse_sec, 0, offsetof(Bridge, ageing_time) diff --git a/test/fuzz/fuzz-netdev-parser/bond.netdev b/test/fuzz/fuzz-netdev-parser/bond.netdev index 4e4885c44c..04e237dd96 100644 --- a/test/fuzz/fuzz-netdev-parser/bond.netdev +++ b/test/fuzz/fuzz-netdev-parser/bond.netdev @@ -14,5 +14,6 @@ MinLinks=1 AdActorSystemPriority=1218 AdUserPortKey=811 AdActorSystem=00:11:22:33:44:55 +ARPMissedMax=10 # feed the sanitizer AdActorSystem=00:11:22:33:44:55