[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251017030509.61794-1-liuhangbin@gmail.com>
Date: Fri, 17 Oct 2025 03:05:09 +0000
From: Hangbin Liu <liuhangbin@...il.com>
To: 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,
Hangbin Liu <liuhangbin@...il.com>
Subject: [PATCH iproute2-next] bond: slave: print master name
Add a new attribute to display the name of the master interface for
each slave.
Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
---
ip/iplink_bond_slave.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ip/iplink_bond_slave.c b/ip/iplink_bond_slave.c
index c88100e248dd..55deaadf5fe2 100644
--- a/ip/iplink_bond_slave.c
+++ b/ip/iplink_bond_slave.c
@@ -92,6 +92,17 @@ static void bond_slave_print_opt(struct link_util *lu, FILE *f, struct rtattr *t
if (!tb)
return;
+ if (tb[IFLA_BOND_SLAVE_MASTER]) {
+ unsigned int ifindex = rta_getattr_u32(tb[IFLA_BOND_SLAVE_MASTER]);
+
+ if (ifindex) {
+ print_string(PRINT_ANY,
+ "master",
+ "master %s ",
+ ll_index_to_name(ifindex));
+ }
+ }
+
if (tb[IFLA_BOND_SLAVE_STATE])
print_slave_state(f, tb[IFLA_BOND_SLAVE_STATE]);
--
2.50.1
Powered by blists - more mailing lists