mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: lvjunyu <lvjunyu@cmss.chinamobile.com>
To: netdev@vger.kernel.org, netdev-bot+sashiko@kernel.org
Cc: pablo@netfilter.org, fw@strlen.de, phil@nwl.cc,
	netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, kuba@kernel.org,
	lvjunyu <lvjunyu@cmss.chinamobile.com>
Subject: Re: [PATCH v3] netfilter: nf_nat: Fix stale outer UDP checksum on VXLAN encapsulated packets
Date: Tue, 13 Oct 2026 17:00:59 +0800	[thread overview]
Message-ID: <20261013090059.2590-1-lvjunyu@cmss.chinamobile.com> (raw)
In-Reply-To: <20261008054228.752274-1-lvjunyu@cmss.chinamobile.com>

Thank you for the review.

> [High] The fix covers only one caller, __udp_manip_pkt() in
> net/netfilter/nf_nat_proto.c.

The scope is intentional.  The LCO state this patch fixes is specific
to the UDP encapsulation path: udp_set_csum() writes a complete
(folded, complemented) checksum into uh->check while leaving
csum_start pointing at the inner transport header.  This split state
arises only for locally generated VXLAN/Geneve outer headers that
traverse the conntrack NAT OUTPUT path.

The flowtable software fast path (nf_flow_nat_ip_udp and friends) is
not reached by these packets.  VXLAN outer headers are locally
generated via vxlan_xmit() -> udp_set_csum() and enter the OUTPUT
chain.  The flowtable hook (nf_flow_offload_ip_hook) is registered
at NF_INET_FORWARD, which locally generated packets do not traverse.
Even after the conntrack entry is established, subsequent outer
packets still follow OUTPUT -> POSTROUTING -> __udp_manip_pkt(),
because flowtable offload applies to forwarded flows, not locally
generated ones.

For the sibling call sites:

- tcp_manip_pkt() and icmpv6_manip_pkt(): the offload target is the
  TCP/ICMPv6 header itself (csum_start + csum_offset == &hdr->check),
  so the LCO condition does not arise.  The seed path is correct for
  these protocols.

- Headers embedded in ICMP errors
  (nf_nat_icmp_reply_translation): byte copies in the ICMP payload,
  not live checksum-offloaded data; ip_summed is typically NONE or
  COMPLETE.

- tcf_nat_act() and IPVS: these paths handle LCO-state encapsulated
  UDP packets in theory, but the practical deployment scenario
  (locally generated VXLAN + MASQUERADE --random-fully) is specific
  to the conntrack NAT OUTPUT path.

A helper-level fix in inet_proto_csum_replace4/16/_by_diff() would
cover all ~45 call sites at once and is architecturally preferable.
However, modifying core checksum helpers that are shared by TCP, UDP,
ICMPv6, eBPF, OVS, GSO offload, and ILA requires a separate, more
thorough analysis and test cycle.  This patch is scoped to the UDP
path where the bug is observed and verified; the helper-level
approach is planned as a follow-up.

--
lvjunyu



  parent reply	other threads:[~2026-10-14  1:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  5:42 lvjunyu
2026-10-12  6:13 ` netdev-bot+sashiko
2026-10-13  9:00 ` lvjunyu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-09-22  6:23 lvjunyu
2026-10-09  3:21 ` netdev-bot+sashiko

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=20261013090059.2590-1-lvjunyu@cmss.chinamobile.com \
    --to=lvjunyu@cmss.chinamobile.com \
    --cc=fw@strlen.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®