From b33bba043480934642e2135c0846cedfd823c00b Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Thu, 15 Feb 2024 16:11:22 +0530 Subject: [PATCH] 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. --- man/systemd.netdev.xml | 12 ++++++++++++ src/libsystemd/sd-netlink/netlink-types-rtnl.c | 1 + src/network/netdev/bond.c | 6 ++++++ src/network/netdev/bond.h | 2 ++ src/network/netdev/netdev-gperf.gperf | 1 + test/fuzz/fuzz-netdev-parser/bond.netdev | 1 + 6 files changed, 23 insertions(+) diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index bf3b5c21dae..08da75f06fc 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 681b3086d08..1fa88b1ca58 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 4d75a0d6bf2..ecf091356bd 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 e4b0a0d94d1..b301fa67f02 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 d5aa522de8d..eb28b9be540 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 4e4885c44c7..04e237dd963 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 -- 2.39.5