From: David Carlier <devnexen@gmail.com>
To: "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>,
Herbert Xu <herbert@gondor.apana.org.au>
Cc: netdev@vger.kernel.org, stable@vger.kernel.org,
David Carlier <devnexen@gmail.com>
Subject: [PATCH v2 1/2] net/sched: act_nat: fix inner IP header checksum in ICMP error packets
Date: Sat, 4 Apr 2026 13:03:09 +0100 [thread overview]
Message-ID: <20260404120310.88218-1-devnexen@gmail.com> (raw)
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
next reply other threads:[~2026-04-04 12:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-04 12:03 David Carlier [this message]
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
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=20260404120310.88218-1-devnexen@gmail.com \
--to=devnexen@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@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 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.