All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] trace: Fix incorrect ICMP code representation
@ 2026-11-25 19:54 Rohit Geetha Bal
  2026-11-26 20:49 ` Phil Sutter
  0 siblings, 1 reply; 4+ messages in thread
From: Rohit Geetha Bal @ 2026-11-25 19:54 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Rohit Geetha Bal

Fix incorrect ICMP code representation in packet trace output.

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=222272
Signed-off-by: Rohit Geetha Bal <rohit.geetha-bal@telenor.se>
Tested-by: Rohit Geetha Bal <rohit.geetha-bal@telenor.se>
---
 src/trace.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/trace.c b/src/trace.c
index 051cc12d..ec7f9e5b 100644
--- a/src/trace.c
+++ b/src/trace.c
@@ -12,6 +12,7 @@
 #include <linux/netfilter/nf_tables.h>
 #include <linux/netfilter.h>
 
+#include <netinet/ip_icmp.h>
 #include <nftables.h>
 #include <mnl.h>
 #include <parser.h>
@@ -232,6 +233,10 @@ next:
 			payload_dependency_kill(pctx, lhs, ctx->family);
 		if (lhs->flags & EXPR_F_PROTOCOL)
 			payload_dependency_store(pctx, stmt, b);
+		if (desc == &proto_icmp &&
+		    payload_hdr_field(lhs) == ICMPHDR_CODE &&
+		    pctx->icmp_type == ICMP_ECHO)
+			expr_set_type(rel->right, &integer_type, lhs->byteorder);
 
 		goto next;
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] trace: Fix incorrect ICMP code representation
  2026-11-25 19:54 [PATCH] trace: Fix incorrect ICMP code representation Rohit Geetha Bal
@ 2026-11-26 20:49 ` Phil Sutter
  2026-12-04 11:28   ` Geetha Bal Rohit (Telenor Sverige AB)
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Sutter @ 2026-11-26 20:49 UTC (permalink / raw)
  To: Rohit Geetha Bal; +Cc: netfilter-devel, Rohit Geetha Bal

Hi Rohit,

On Wed, Nov 25, 2026 at 07:54:05PM +0000, Rohit Geetha Bal wrote:
> Fix incorrect ICMP code representation in packet trace output.

The description is a bit meager given the elaborate bug report you're
linking to.

> Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=222272

This is the wrong bugzilla. Correct link is:

https://bugzilla.kernel.org/show_bug.cgi?id=222272

Please keep in mind that links to external web sites should not replace
commit descriptions since they are prone to go 404 sooner or later.

> Signed-off-by: Rohit Geetha Bal <rohit.geetha-bal@telenor.se>
> Tested-by: Rohit Geetha Bal <rohit.geetha-bal@telenor.se>

A bit redundant, one may expect that an author did test their code. :)

BTW: How did you test it? I'm failing to do so, using a simple rule 'oif
"test0" meta nftrace set 1'. Pinging from both sides gives me:

| # nft monitor trace
| trace id 058e9d40 ip t c packet: oif "test0" ip saddr 10.0.0.1 ip daddr 10.0.0.2 ip dscp cs0 ip ecn not-ect ip ttl 64 ip id 14699 ip length 84 icmp type echo-request icmp code 0 icmp id 52743 icmp sequence 1 
| trace id 058e9d40 ip t c rule oif "test0" meta nftrace set 1 (verdict continue)
| trace id 058e9d40 ip t c policy accept 
| trace id 81be10a5 ip t c packet: oif "test0" ip saddr 10.0.0.1 ip daddr 10.0.0.2 ip dscp cs0 ip ecn not-ect ip ttl 64 ip id 23411 ip length 84 icmp type echo-reply icmp code 0 icmp id 17703 icmp sequence 1 
| trace id 81be10a5 ip t c rule oif "test0" meta nftrace set 1 (verdict continue)
| trace id 81be10a5 ip t c policy accept

Having 'icmp code 0' in there is fine, I guess.

Cheers, Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] trace: Fix incorrect ICMP code representation
  2026-11-26 20:49 ` Phil Sutter
@ 2026-12-04 11:28   ` Geetha Bal Rohit (Telenor Sverige AB)
  2026-12-04 13:41     ` Phil Sutter
  0 siblings, 1 reply; 4+ messages in thread
From: Geetha Bal Rohit (Telenor Sverige AB) @ 2026-12-04 11:28 UTC (permalink / raw)
  To: Phil Sutter, Rohit Geetha Bal; +Cc: netfilter-devel@vger.kernel.org

Hej Phil,

Sorry for taking you down this rabbit hole! :( Looks like I might have been testing with an older Ubuntu version. I'm running nftables v1.0.9 (Old Doc Yak #3).

Thanks for your patience and for the helpful feedback!

If possible, I'll look a bit more into nft describe icmp code and try to understand what's happening.

Rohit

________________________________________
From: Phil Sutter <phil@nwl.cc>
Sent: Thursday, November 26, 2026 9:49 PM
To: Rohit Geetha Bal <rohitgbal@gmail.com>
Cc: netfilter-devel@vger.kernel.org <netfilter-devel@vger.kernel.org>; Geetha Bal Rohit (Telenor Sverige AB) <rohit.geetha-bal@telenor.se>
Subject: Re: [PATCH] trace: Fix incorrect ICMP code representation

Hi Rohit,

On Wed, Nov 25, 2026 at 07:54:05PM +0000, Rohit Geetha Bal wrote:
> Fix incorrect ICMP code representation in packet trace output.

The description is a bit meager given the elaborate bug report you're
linking to.

> Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=222272

This is the wrong bugzilla. Correct link is:

https://bugzilla.kernel.org/show_bug.cgi?id=222272

Please keep in mind that links to external web sites should not replace
commit descriptions since they are prone to go 404 sooner or later.

> Signed-off-by: Rohit Geetha Bal <rohit.geetha-bal@telenor.se>
> Tested-by: Rohit Geetha Bal <rohit.geetha-bal@telenor.se>

A bit redundant, one may expect that an author did test their code. :)

BTW: How did you test it? I'm failing to do so, using a simple rule 'oif
"test0" meta nftrace set 1'. Pinging from both sides gives me:

| # nft monitor trace
| trace id 058e9d40 ip t c packet: oif "test0" ip saddr 10.0.0.1 ip daddr 10.0.0.2 ip dscp cs0 ip ecn not-ect ip ttl 64 ip id 14699 ip length 84 icmp type echo-request icmp code 0 icmp id 52743 icmp sequence 1
| trace id 058e9d40 ip t c rule oif "test0" meta nftrace set 1 (verdict continue)
| trace id 058e9d40 ip t c policy accept
| trace id 81be10a5 ip t c packet: oif "test0" ip saddr 10.0.0.1 ip daddr 10.0.0.2 ip dscp cs0 ip ecn not-ect ip ttl 64 ip id 23411 ip length 84 icmp type echo-reply icmp code 0 icmp id 17703 icmp sequence 1
| trace id 81be10a5 ip t c rule oif "test0" meta nftrace set 1 (verdict continue)
| trace id 81be10a5 ip t c policy accept

Having 'icmp code 0' in there is fine, I guess.

Cheers, Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] trace: Fix incorrect ICMP code representation
  2026-12-04 11:28   ` Geetha Bal Rohit (Telenor Sverige AB)
@ 2026-12-04 13:41     ` Phil Sutter
  0 siblings, 0 replies; 4+ messages in thread
From: Phil Sutter @ 2026-12-04 13:41 UTC (permalink / raw)
  To: Geetha Bal Rohit (Telenor Sverige AB)
  Cc: Rohit Geetha Bal, netfilter-devel@vger.kernel.org

Hi Rohit,

On Fri, Dec 04, 2026 at 11:28:22AM +0000, Geetha Bal Rohit (Telenor Sverige AB) wrote:
> Sorry for taking you down this rabbit hole! :( Looks like I might have been testing with an older Ubuntu version. I'm running nftables v1.0.9 (Old Doc Yak #3).

OK, I'll declare "downstream issue" here then. Do them a favor and test
on an up to date Ubuntu before reporting to them if it still happens.

> Thanks for your patience and for the helpful feedback!

You're welcome!

Cheers, Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-04 13:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 19:54 [PATCH] trace: Fix incorrect ICMP code representation Rohit Geetha Bal
2026-11-26 20:49 ` Phil Sutter
2026-12-04 11:28   ` Geetha Bal Rohit (Telenor Sverige AB)
2026-12-04 13:41     ` Phil Sutter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.