public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] net/sched: act_nat: fix inner IP header checksum in ICMP error packets
@ 2026-04-04 12:03 David Carlier
  2026-04-04 12:03 ` [PATCH v2 2/2] selftests: net: add act_nat ICMP inner checksum test David Carlier
  0 siblings, 1 reply; 3+ messages in thread
From: David Carlier @ 2026-04-04 12:03 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Herbert Xu
  Cc: netdev, stable, David Carlier

Update the inner IP header checksum when rewriting addresses
inside ICMP error payloads, matching netfilter's nf_nat_ipv4_manip_pkt()
behavior.

Fixes: b4219952356b ("[PKT_SCHED]: Add stateless NAT")
Cc: stable@vger.kernel.org
Signed-off-by: David Carlier <devnexen@gmail.com>
---
 net/sched/act_nat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index abb332dee836..cd1d299da57c 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -242,7 +242,9 @@ TC_INDIRECT_SCOPE int tcf_nat_act(struct sk_buff *skb,
 		new_addr &= mask;
 		new_addr |= addr & ~mask;
 
-		/* XXX Fix up the inner checksums. */
+		/* Update inner IP header checksum after address rewrite */
+		csum_replace4(&iph->check, addr, new_addr);
+
 		if (egress)
 			iph->daddr = new_addr;
 		else
-- 
2.53.0


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

end of thread, other threads:[~2026-04-04 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-04 12:03 [PATCH v2 1/2] net/sched: act_nat: fix inner IP header checksum in ICMP error packets David Carlier
2026-04-04 12:03 ` [PATCH v2 2/2] selftests: net: add act_nat ICMP inner checksum test David Carlier
2026-04-04 18:01   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox