From: Hangbin Liu <liuhangbin@gmail.com>
To: netdev@vger.kernel.org
Cc: Jay Vosburgh <jv@jvosburgh.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Stephen Hemminger <stephen@networkplumber.org>,
David Ahern <dsahern@gmail.com>,
linux-kselftest@vger.kernel.org,
Hangbin Liu <liuhangbin@gmail.com>
Subject: [PATCH iproute2-next] bond: slave: print master name
Date: Fri, 17 Oct 2025 03:05:09 +0000 [thread overview]
Message-ID: <20251017030509.61794-1-liuhangbin@gmail.com> (raw)
In-Reply-To: <20251017030310.61755-1-liuhangbin@gmail.com>
Add a new attribute to display the name of the master interface for
each slave.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.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
next prev parent reply other threads:[~2025-10-17 3:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 3:03 [PATCH net-next] bonding: show master index when dumping slave info Hangbin Liu
2025-10-17 3:05 ` Hangbin Liu [this message]
2025-10-18 8:57 ` [PATCH iproute2-next] bond: slave: print master name Stephen Hemminger
2025-10-17 6:10 ` [PATCH net-next] bonding: show master index when dumping slave info Nikolay Aleksandrov
2025-10-17 7:26 ` Hangbin Liu
2025-10-17 9:56 ` Jiri Pirko
2025-10-18 9:52 ` Hangbin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251017030509.61794-1-liuhangbin@gmail.com \
--to=liuhangbin@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).