From: Florian Westphal <fw@strlen.de>
To: allfox wy <allfoxwy@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: [regression] Completely editing packet should be allowed.
Date: Mon, 9 Nov 2026 15:19:13 +0100 [thread overview]
Message-ID: <avHWYRPcjP0ITv8b@strlen.de> (raw)
In-Reply-To: <CAPH4NY1NhxqqEbf8Ky+AaA561a0x6fDB3cS27FbVizx9ybm21w@mail.gmail.com>
allfox wy <allfoxwy@gmail.com> wrote:
> Thank you for explanation. I did a test. It is indeed the protocol
> number change in homebrew causing the block.
>
> However, calling nf_reset_ct(e->skb) would still result in packet
> being dropped. I didn't do a precise diagnose to find out where it got
> dropped. But replacing nf_reset_ct(e->skb) with "return true" would
> result in a working system.
Unfortunately that is the problematic part.
I'm not even sure how this scheme of yours works:
The NAT dispatch uses the l4proto value from the tuple to decide
what to do.
So as far as I can see NAT postrouting will write updated tcp/udp
port to the packet, which is no longer udp/tcp - corrupting
the l4 header.
> My deduction: in the system's NAT table there is MASQUERADE in
> POSTROUTING. As my understanding, MASQUERADE requires CONNTRACK
> information to work. When the outgoing packet going through MANGLE
> table and got nf_reset_ct(e->skb), later MASQUERADE in NAT table might
> dropped it.
The removal of the conntrack info causes the packet to be treated as
INVALID; MASQUERADE / SNAT will not work on it.
> Is there a function that recalculate the CONNTRACK info rather than
> deleting it please?
We would need to make a re-lookup (possibly creating a new conntrack
entry) that reflects the new/updated L4protocol + any other changes to
saddr/daddr.
next prev parent reply other threads:[~2026-11-09 14:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 19:02 [regression] Completely editing packet should be allowed allfox wy
2026-11-06 5:08 ` Florian Westphal
2026-11-06 11:46 ` Pablo Neira Ayuso
2026-11-07 8:04 ` allfox wy
2026-11-07 8:10 ` allfox wy
2026-11-09 10:25 ` Pablo Neira Ayuso
2026-11-09 10:49 ` Pablo Neira Ayuso
2026-11-09 14:19 ` Florian Westphal [this message]
2026-11-09 15:45 ` allfox wy
2026-11-09 16:19 ` Florian Westphal
2026-11-09 16:44 ` allfox wy
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=avHWYRPcjP0ITv8b@strlen.de \
--to=fw@strlen.de \
--cc=allfoxwy@gmail.com \
--cc=netfilter@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.