From: Florian Westphal <fw@strlen.de>
To: xietangxin <xietangxin@h-partners.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Phil Sutter <phil@nwl.cc>,
"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>,
gaoxingwang <gaoxingwang1@huawei.com>,
huyizhen <huyizhen2@huawei.com>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH net] netfilter: nf_nat_masquerade: recalculate TCP TS offset when port is randomized
Date: Wed, 1 Jul 2026 16:17:45 +0200 [thread overview]
Message-ID: <akUhid7_3iHovivd@strlen.de> (raw)
In-Reply-To: <0ad60f06-387e-49bc-9e26-3dcebf182cb4@h-partners.com>
xietangxin <xietangxin@h-partners.com> wrote:
> Shifting the helper down to nf_nat_l4proto_unique_tuple() as you suggested
> encounters a structural roadblock. we don't have access to the skb there.
> Adding skb to all intermediate callers (like nf_nat_setup_info, get_unique_tuple)
> would severely pollute the core NAT APIs.
Right, propagating the skb is too much code churn.
> would it be acceptable to place this logic in nf_nat_inet_fn() before do_nat?
>
> 963 do_nat:
> ..here
This is hit for every packet, not just the first one after
nf_nat_setup_info(). I suggest a slightly earlier spot in the
same function.
936 ret = e->hooks[i].hook(e->hooks[i].priv, skb,
937 state);
938 if (ret != NF_ACCEPT)
939 return ret;
940 if (nf_nat_initialized(ct, maniptype))
941 goto do_nat;
942 }
943 null_bind:
944 ret = nf_nat_alloc_null_binding(ct, state->hook);
945 if (ret != NF_ACCEPT)
946 return ret;
.... Here.
947 } else {
This spot runs only for new connections, right after a nf_nat_setup_info() call.
next prev parent reply other threads:[~2026-07-01 14:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 9:34 [PATCH net] netfilter: nf_nat_masquerade: recalculate TCP TS offset when port is randomized xietangxin
2026-06-29 13:09 ` Victor Nogueira
2026-06-29 15:23 ` Florian Westphal
2026-07-01 14:09 ` xietangxin
2026-07-01 14:17 ` Florian Westphal [this message]
2026-07-06 12:08 ` xietangxin
2026-06-29 21:10 ` kernel test robot
2026-07-01 1:44 ` Jiayuan Chen
2026-07-01 14:11 ` xietangxin
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=akUhid7_3iHovivd@strlen.de \
--to=fw@strlen.de \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gaoxingwang1@huawei.com \
--cc=horms@kernel.org \
--cc=huyizhen2@huawei.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=stable@vger.kernel.org \
--cc=xietangxin@h-partners.com \
/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.