network/netdev: add bond LACPActive= setting

This allows configuring a bond in 802.3ad mode to use active or passive
LACP. During LACP discovery, active LACP routinely transmits LACPDUs, while
passive LACP only sends LACPDUs in response to a partner's LACPDU.
This commit is contained in:
Jake Freeland authored and Yu Watanabe committed 2026-11-05 12:12:50 +09:00
1 parent efca02fa36
commit a9e4ac6fa1
10 files changed
+50 -2

No files matched your search

+13
View File
@@ -2349,6 +2349,19 @@ Ports=eth2</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>LACPActive=</varname></term>
<listitem>
<para>Specifies whether the device should actively send out LACPDUs to
establish a channel with an LACP partner. Takes a boolean. When false,
the device is passive during LACP discovery, only sending out LACPDUs
in response to a partner's LACPDU. When unset, the kernel's default
will be used.</para>
<xi:include href="version-info.xml" xpointer="v263"/>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>MIIMonitorSec=</varname></term>
<listitem>
@@ -117,6 +117,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_AD_LACP_ACTIVE] = BUILD_POLICY(U8),
[IFLA_BOND_MISSED_MAX] = BUILD_POLICY(U8),
};
+9
View File
@@ -96,6 +96,14 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
return r;
}
if (b->lacp_active >= 0 &&
b->mode == NETDEV_BOND_MODE_802_3AD &&
!up) {
r = sd_netlink_message_append_u8(m, IFLA_BOND_AD_LACP_ACTIVE, b->lacp_active);
if (r < 0)
return r;
}
if (b->miimon != 0) {
r = sd_netlink_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / USEC_PER_MSEC);
if (r < 0)
@@ -418,6 +426,7 @@ static void bond_init(NetDev *netdev) {
b->all_slaves_active = false;
b->tlb_dynamic_lb = -1;
b->lacp_active = -1;
b->resend_igmp = RESEND_IGMP_DEFAULT;
b->packets_per_slave = PACKETS_PER_SLAVE_DEFAULT;
+1
View File
@@ -17,6 +17,7 @@ typedef struct Bond {
BondPrimaryReselect primary_reselect;
int tlb_dynamic_lb;
int lacp_active;
bool all_slaves_active;
+1
View File
@@ -212,6 +212,7 @@ Tap.KeepCarrier, config_parse_bool,
Bond.Mode, config_parse_bond_mode, 0, offsetof(Bond, mode)
Bond.TransmitHashPolicy, config_parse_bond_xmit_hash_policy, 0, offsetof(Bond, xmit_hash_policy)
Bond.LACPTransmitRate, config_parse_bond_lacp_rate, 0, offsetof(Bond, lacp_rate)
Bond.LACPActive, config_parse_tristate, 0, offsetof(Bond, lacp_active)
Bond.AdSelect, config_parse_bond_ad_select, 0, offsetof(Bond, ad_select)
Bond.FailOverMACPolicy, config_parse_bond_fail_over_mac, 0, offsetof(Bond, fail_over_mac)
Bond.ARPIPTargets, config_parse_arp_ip_target_address, 0, 0
+1
View File
@@ -7,6 +7,7 @@ Mode=802.3ad
TransmitHashPolicy=layer3+4
MIIMonitorSec=1s
LACPTransmitRate=fast
LACPActive=true
UpDelaySec=2s
DownDelaySec=2s
ResendIGMP=4
@@ -506,6 +506,7 @@ Kind=
L2MissNotification=
L3MasterDevice=
L3MissNotification=
LACPActive=
LACPTransmitRate=
LLDP=
LLMNR=
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[NetDev]
Name=bond96
Kind=bond
[Bond]
Mode=802.3ad
LACPActive=no
+1
View File
@@ -8,6 +8,7 @@ Mode=802.3ad
TransmitHashPolicy=layer3+4
MIIMonitorSec=1s
LACPTransmitRate=fast
LACPActive=yes
UpDelaySec=2s
DownDelaySec=2s
ResendIGMP=4
+14 -2
View File
@@ -2095,18 +2095,25 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertIn('fdb_max_learned 4 ', output)
def test_bond(self):
copy_network_unit('25-bond.netdev', '25-bond-balanced-tlb.netdev', '25-bond-property.netdev')
copy_network_unit(
'25-bond.netdev',
'25-bond-balanced-tlb.netdev',
'25-bond-property.netdev',
'25-bond-lacp-passive.netdev',
)
start_networkd()
self.wait_online('bond99:off', 'bond98:off', 'bond97:off', setup_state='unmanaged')
self.wait_online('bond99:off', 'bond98:off', 'bond97:off', 'bond96:off', setup_state='unmanaged')
self.networkctl_check_unit('bond99', '25-bond')
self.networkctl_check_unit('bond98', '25-bond-balanced-tlb')
self.networkctl_check_unit('bond97', '25-bond-property')
self.networkctl_check_unit('bond96', '25-bond-lacp-passive')
self.check_link_attr('bond99', 'bonding', 'mode', '802.3ad 4')
self.check_link_attr('bond99', 'bonding', 'xmit_hash_policy', 'layer3+4 1')
self.check_link_attr('bond99', 'bonding', 'miimon', '1000')
self.check_link_attr('bond99', 'bonding', 'lacp_rate', 'fast 1')
self.check_link_attr('bond99', 'bonding', 'lacp_active', 'on 1')
self.check_link_attr('bond99', 'bonding', 'updelay', '2000')
self.check_link_attr('bond99', 'bonding', 'downdelay', '2000')
self.check_link_attr('bond99', 'bonding', 'resend_igmp', '4')
@@ -2135,6 +2142,11 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.check_link_attr('bond97', 'bonding', 'arp_missed_max', '10')
self.check_link_attr('bond97', 'bonding', 'peer_notif_delay', '300000')
output = networkctl_status('bond96')
print(output)
self.check_link_attr('bond96', 'bonding', 'lacp_active', 'off 0')
def check_vlan(self, id, flags):
self.wait_online('test1:degraded', 'vlan99:routable')
self.networkctl_check_unit('vlan99', '21-vlan', '21-vlan')