The upstream kernel has supported broadcast_neighbor for 802.3ad mode since commit ce7a381697cb ("net: bonding: add broadcast_neighbor option for 802.3ad"). When upgrading from our local kernel to 6.18.y stable, we switched from our out-of-tree implementation to the upstream one. However, the iproute2 package on our production servers is too old to support the broadcast_neighbor option. To enable this feature, add a new sysfs attribute at: /sys/class/net//bonding/broadcast_neighbor This allows enabling the feature by writing "1" to the sysfs file, matching the interface we previously maintained in our local kernel. The result is as follows, - For 802.3ad mode $ ip link add bond0 type bond mode 802.3ad $ cat /sys/class/net/bond0/bonding/broadcast_neighbor 0 $ echo 1 > /sys/class/net/bond0/bonding/broadcast_neighbor $ cat /sys/class/net/bond0/bonding/broadcast_neighbor 1 - For other modes $ ip link add bond1 type bond $ cat /sys/class/net/bond1/bonding/broadcast_neighbor 0 $ echo 1 > /sys/class/net/bond1/bonding/broadcast_neighbor bash: echo: write error: Permission denied Signed-off-by: Yafang Shao Cc: Tonghao Zhang --- drivers/net/bonding/bond_sysfs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index eaba44c76a5e..24eb23634d98 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -750,6 +750,17 @@ static ssize_t bonding_show_ad_user_port_key(struct device *d, static DEVICE_ATTR(ad_user_port_key, 0644, bonding_show_ad_user_port_key, bonding_sysfs_store_option); +static ssize_t bonding_show_broadcast_neighbor(struct device *d, + struct device_attribute *attr, + char *buf) +{ + struct bonding *bond = to_bond(d); + + return sysfs_emit(buf, "%d\n", bond->params.broadcast_neighbor); +} +static DEVICE_ATTR(broadcast_neighbor, 0644, + bonding_show_broadcast_neighbor, bonding_sysfs_store_option); + static struct attribute *per_bond_attrs[] = { &dev_attr_slaves.attr, &dev_attr_mode.attr, @@ -789,6 +800,7 @@ static struct attribute *per_bond_attrs[] = { &dev_attr_ad_actor_system.attr, &dev_attr_ad_user_port_key.attr, &dev_attr_arp_missed_max.attr, + &dev_attr_broadcast_neighbor.attr, NULL, }; -- 2.52.0