Re: [PATCH net-next v5 3/7] bonding: arp_ip_target helpers.
From: Paolo Abeni <pabeni@redhat.com>
Date: 2025-09-09 13:25:37
On 7/15/25 12:54 AM, David Wilder wrote:
quoted hunk ↗ jump to hunk
diff --git a/include/net/bonding.h b/include/net/bonding.h index 27fbce667a4c..1989b71ffa16 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h@@ -809,4 +809,49 @@ static inline netdev_tx_t bond_tx_drop(struct net_device *dev, struct sk_buff *s return NET_XMIT_DROP; } +/* Helpers for handling arp_ip_target */ +#define BOND_OPTION_STRING_MAX_SIZE 64 +#define BOND_VLAN_PROTO_NONE cpu_to_be16(0xffff) + +static inline char *bond_arp_target_to_string(struct bond_arp_target *target, + char *buf, int size) +{ + struct bond_vlan_tag *tags = target->tags; + int i, num = 0; + + if (!(target->flags & BOND_TARGET_USERTAGS)) { + num = snprintf(&buf[0], size, "%pI4", &target->target_ip); + return buf; + } + + num = snprintf(&buf[0], size, "%pI4[", &target->target_ip); + if (tags) { + for (i = 0; (tags[i].vlan_proto != BOND_VLAN_PROTO_NONE); i++) { + if (!tags[i].vlan_id) + continue; + if (i != 0) + num = num + snprintf(&buf[num], size-num, "/"); + num = num + snprintf(&buf[num], size-num, "%u",
Minor nits above: 'size-num' -> 'size - num' /P