Netdev List
 help / color / mirror / Atom feed
From: Dave Seddon <dave.seddon.ca@gmail.com>
To: dave.seddon.ca@gmail.com, netdev@vger.kernel.org
Subject: [PATCH iproute2 1/3] iplink_bond_slave: read ad_partner_oper_port_state as u16
Date: Sat, 10 Oct 2026 20:29:04 -0700	[thread overview]
Message-ID: <20261011032906.1398174-2-dave.seddon.ca@gmail.com> (raw)
In-Reply-To: <20261011032906.1398174-1-dave.seddon.ca@gmail.com>

The kernel emits IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE with
nla_put_u16() in bond_fill_slave_info(), but iproute2 reads only the
first payload byte with rta_getattr_u8().

On big-endian systems, valid LACP states have a zero high byte, so
both the numeric partner state and its decoded flags are displayed
as zero/empty. Little-endian systems display the low byte correctly
for the eight defined LACP state bits.

Restore the u16 accessor used before the string formatting change.
The actor state remains u8, matching the kernel attribute.

Fixes: 39ac2d2b802b ("iplink: bond: print lacp actor/partner oper states as strings")
Assisted-by: LLM
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 ip/iplink_bond_slave.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ip/iplink_bond_slave.c b/ip/iplink_bond_slave.c
index f4b28fbc..24e73575 100644
--- a/ip/iplink_bond_slave.c
+++ b/ip/iplink_bond_slave.c
@@ -145,7 +145,7 @@ static void bond_slave_print_opt(struct link_util *lu, FILE *f, struct rtattr *t
 	}
 
 	if (tb[IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE]) {
-		__u16 state = rta_getattr_u8(tb[IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE]);
+		__u16 state = rta_getattr_u16(tb[IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE]);
 
 		print_int(PRINT_ANY,
 			  "ad_partner_oper_port_state",
-- 
2.55.0


  reply	other threads:[~2026-10-11  3:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11  3:29 [PATCH iproute2 0/3] iplink: bond: fix partner LACP state decoding Dave Seddon
2026-10-11  3:29 ` Dave Seddon [this message]
2026-10-11  3:29 ` [PATCH iproute2 2/3] testsuite: fix test_on_not on multi-line output Dave Seddon
2026-10-11  3:29 ` [PATCH iproute2 3/3] testsuite: add bond slave LACP port state test Dave Seddon

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=20261011032906.1398174-2-dave.seddon.ca@gmail.com \
    --to=dave.seddon.ca@gmail.com \
    --cc=netdev@vger.kernel.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