summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-02-16 22:16:42 +0100
committerGitHub <noreply@github.com>2024-02-16 22:16:42 +0100
commite21dd22040d5dc6a8beb4ff87227c0881a99496e (patch)
treea46a5f38381a137b84564be0d9573396f7199522
parentresolve: provide service resolve over varlink (diff)
parenttest-network: Add test for bond arp_missed_max option (diff)
downloadsystemd-e21dd22040d5dc6a8beb4ff87227c0881a99496e.tar.xz
systemd-e21dd22040d5dc6a8beb4ff87227c0881a99496e.zip
Merge pull request #31338 from ssahani/network-bond-missed
network: netdev - bond add support for ARP missed max
-rw-r--r--man/systemd.netdev.xml12
-rw-r--r--src/libsystemd/sd-netlink/netlink-types-rtnl.c1
-rw-r--r--src/network/netdev/bond.c6
-rw-r--r--src/network/netdev/bond.h2
-rw-r--r--src/network/netdev/netdev-gperf.gperf1
-rw-r--r--test/fuzz/fuzz-netdev-parser/bond.netdev1
-rw-r--r--test/test-network/conf/25-bond-property.netdev9
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py9
8 files changed, 39 insertions, 2 deletions
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 @@
<xi:include href="version-info.xml" xpointer="v220"/>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><varname>ARPMissedMax=</varname></term>
+ <listitem>
+ <para>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.
+ </para>
+
+ <xi:include href="version-info.xml" xpointer="v256"/>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>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
diff --git a/test/test-network/conf/25-bond-property.netdev b/test/test-network/conf/25-bond-property.netdev
new file mode 100644
index 0000000000..6e4043fcd6
--- /dev/null
+++ b/test/test-network/conf/25-bond-property.netdev
@@ -0,0 +1,9 @@
+[NetDev]
+Name=bond97
+Kind=bond
+
+[Bond]
+Mode=active-backup
+PrimaryReselectPolicy=always
+MIIMonitorSec=1s
+ARPMissedMax=10
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 272c57a77b..661ac8ec7a 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -1482,10 +1482,10 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertIn('vlan_default_pvid 9 ', output)
def test_bond(self):
- copy_network_unit('25-bond.netdev', '25-bond-balanced-tlb.netdev')
+ copy_network_unit('25-bond.netdev', '25-bond-balanced-tlb.netdev', '25-bond-property.netdev')
start_networkd()
- self.wait_online('bond99:off', 'bond98:off', setup_state='unmanaged')
+ self.wait_online('bond99:off', 'bond98:off', 'bond97:off', setup_state='unmanaged')
self.check_link_attr('bond99', 'bonding', 'mode', '802.3ad 4')
self.check_link_attr('bond99', 'bonding', 'xmit_hash_policy', 'layer3+4 1')
@@ -1513,6 +1513,11 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
print(output)
self.assertIn('Mode: balance-tlb', output)
+ output = networkctl_status('bond97')
+ print(output)
+
+ self.check_link_attr('bond97', 'bonding', 'arp_missed_max', '10')
+
def test_vlan(self):
copy_network_unit('21-vlan.netdev', '11-dummy.netdev',
'21-vlan.network', '21-vlan-test1.network')