lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0be57e07-3b90-44f7-85d5-97a90ac13831@blackwall.org>
Date: Fri, 17 Oct 2025 09:10:09 +0300
From: Nikolay Aleksandrov <razor@...ckwall.org>
To: Hangbin Liu <liuhangbin@...il.com>, netdev@...r.kernel.org
Cc: Jay Vosburgh <jv@...sburgh.net>, Andrew Lunn <andrew+netdev@...n.ch>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 Simon Horman <horms@...nel.org>,
 Stephen Hemminger <stephen@...workplumber.org>,
 David Ahern <dsahern@...il.com>, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net-next] bonding: show master index when dumping slave
 info

On 10/17/25 06:03, Hangbin Liu wrote:
> Currently, there is no straightforward way to obtain the master/slave
> relationship via netlink. Users have to retrieve all slaves through sysfs
> to determine these relationships.
> 

How about IFLA_MASTER? Why not use that?

> To address this, we can either list all slaves under the bond interface
> or display the master index in each slave. Since the number of slaves could
> be quite large (e.g., 100+), it is more efficient to show the master
> information in the slave entry.
> 
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
>  drivers/net/bonding/bond_netlink.c | 4 ++++
>  include/uapi/linux/if_link.h       | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
> index 286f11c517f7..ff3f11674a8b 100644
> --- a/drivers/net/bonding/bond_netlink.c
> +++ b/drivers/net/bonding/bond_netlink.c
> @@ -29,6 +29,7 @@ static size_t bond_get_slave_size(const struct net_device *bond_dev,
>  		nla_total_size(sizeof(u16)) +	/* IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE */
>  		nla_total_size(sizeof(s32)) +	/* IFLA_BOND_SLAVE_PRIO */
>  		nla_total_size(sizeof(u16)) +	/* IFLA_BOND_SLAVE_ACTOR_PORT_PRIO */
> +		nla_total_size(sizeof(u32)) +	/* IFLA_BOND_SLAVE_MASTER */
>  		0;
>  }
>  
> @@ -38,6 +39,9 @@ static int bond_fill_slave_info(struct sk_buff *skb,
>  {
>  	struct slave *slave = bond_slave_get_rtnl(slave_dev);
>  
> +	if (nla_put_u32(skb, IFLA_BOND_SLAVE_MASTER, bond_dev->ifindex))
> +		goto nla_put_failure;
> +
>  	if (nla_put_u8(skb, IFLA_BOND_SLAVE_STATE, bond_slave_state(slave)))
>  		goto nla_put_failure;
>  
> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> index 3b491d96e52e..bad41a1807f7 100644
> --- a/include/uapi/linux/if_link.h
> +++ b/include/uapi/linux/if_link.h
> @@ -1567,6 +1567,7 @@ enum {
>  	IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE,
>  	IFLA_BOND_SLAVE_PRIO,
>  	IFLA_BOND_SLAVE_ACTOR_PORT_PRIO,
> +	IFLA_BOND_SLAVE_MASTER,
>  	__IFLA_BOND_SLAVE_MAX,
>  };
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ