* [PATCH iproute2] u32: fix IPv6 port match pretty printing
@ 2026-08-31 10:40 Prabhakar Pujeri
2026-09-01 15:58 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Prabhakar Pujeri @ 2026-08-31 10:40 UTC (permalink / raw)
To: prabhakar.pujeri, netdev
parse_ip6() stores source and destination ports in the 32-bit key at
offset 40. print_ipv6() checks offset 20 instead, so it does not print
the decoded port fields. The source and destination labels in that case
are also reversed relative to the layout produced by pack_key16().
Handle offset 40 and use the source label for the high half and the
destination label for the low half. This matches the parser and the
equivalent IPv4 printer in both text and JSON output.
Fixes: d13cee6d598d ("Add IPV6 match pretty print")
Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@dell.com>
---
tc/f_u32.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tc/f_u32.c b/tc/f_u32.c
index ae285146..304fbfa8 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -948,22 +948,22 @@ static void print_ipv6(const struct tc_u32_key *key)
}
break;
- case 20:
+ case 40:
switch (ntohl(key->mask)) {
case 0x0000ffff:
print_nl();
- print_uint(PRINT_ANY, "sport", " match sport %u",
+ print_uint(PRINT_ANY, "dport", " match dport %u",
ntohl(key->val) & 0xffff);
break;
case 0xffff0000:
- print_uint(PRINT_ANY, "dport", "match dport %u",
+ print_uint(PRINT_ANY, "sport", "match sport %u",
ntohl(key->val) >> 16);
break;
case 0xffffffff:
print_nl();
- print_uint(PRINT_ANY, "sport", " match sport %u, ",
+ print_uint(PRINT_ANY, "dport", " match dport %u, ",
ntohl(key->val) & 0xffff);
- print_uint(PRINT_ANY, "dport", "match dport %u",
+ print_uint(PRINT_ANY, "sport", "match sport %u",
ntohl(key->val) >> 16);
break;
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] u32: fix IPv6 port match pretty printing
2026-08-31 10:40 [PATCH iproute2] u32: fix IPv6 port match pretty printing Prabhakar Pujeri
@ 2026-09-01 15:58 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-09-01 15:58 UTC (permalink / raw)
To: Prabhakar Pujeri; +Cc: netdev
On Mon, 31 Aug 2026 10:40:57 +0000
Prabhakar Pujeri <prabhakar.pujeri@dell.com> wrote:
> parse_ip6() stores source and destination ports in the 32-bit key at
> offset 40. print_ipv6() checks offset 20 instead, so it does not print
> the decoded port fields. The source and destination labels in that case
> are also reversed relative to the layout produced by pack_key16().
>
> Handle offset 40 and use the source label for the high half and the
> destination label for the low half. This matches the parser and the
> equivalent IPv4 printer in both text and JSON output.
>
> Fixes: d13cee6d598d ("Add IPV6 match pretty print")
> Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@dell.com>
> ---
> tc/f_u32.c | 10 +++++-----
Used the new review-prompts for iproute and it saw incorrect placement
of print_nl() so I fixed that during merge
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-01 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 10:40 [PATCH iproute2] u32: fix IPv6 port match pretty printing Prabhakar Pujeri
2026-09-01 15:58 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox