[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da385d5b-6ca7-4d91-ad8a-6adb5927a889@redhat.com>
Date: Thu, 16 Oct 2025 13:14:03 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: David Wilder <wilder@...ibm.com>, netdev@...r.kernel.org
Cc: jv@...sburgh.net, pradeep@...ibm.com, i.maximets@....org,
amorenoz@...hat.com, haliu@...hat.com, stephen@...workplumber.org,
horms@...nel.org, kuba@...nel.org, andrew+netdev@...n.ch, edumazet@...gle.com
Subject: Re: [PATCH net-next v13 3/7] bonding: arp_ip_target helpers.
Hi,
On 10/14/25 1:52 AM, David Wilder wrote:
> Adding helpers and defines needed for extending the
> arp_ip_target parameters.
>
> Signed-off-by: David Wilder <wilder@...ibm.com>
> ---
> include/net/bonding.h | 50 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
>
> diff --git a/include/net/bonding.h b/include/net/bonding.h
> index 3497e5061f90..62359b34b69c 100644
> --- a/include/net/bonding.h
> +++ b/include/net/bonding.h
> @@ -809,4 +809,54 @@ 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_MAX_VLAN_TAGS 5
> +#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)
I'm sorry for not catching this before; 'target' argument should be const:
const struct bond_arp_target *target
> +{
> + 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",
> + tags[i].vlan_id);
The above is safe under the assumption that the provided buffer size is
large enough to fit all the tags. The above limits respect this
constraint, but some build time checks could possibly help.
/P
Powered by blists - more mailing lists