From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nf-next 0/3] netfilter: conntrack: clash resolution for reverse collisions
Date: Tue, 10 Sep 2024 11:38:13 +0200 [thread overview]
Message-ID: <20240910093821.4871-1-fw@strlen.de> (raw)
This series resolves an esoteric scenario.
Given two tasks sending UDP packets to one another, NAT engine
can falsely detect a port collision if it happens to pick up
a reply packet as 'new' rather than 'reply'.
First patch adds extra code to detect this and suppress port
reallocation in this case.
Second patch extends clash resolution logic to detect such
a reverse clash (clashing conntrack is reply to existing entry).
Patch 3 adds a test case.
Since this has existed forever and hasn't been reported in two
decades I'm submitting this for -next.
Florian Westphal (3):
netfilter: nf_nat: don't try nat source port reallocation for reverse
dir clash
netfilter: conntrack: add clash resolution for reverse collisions
selftests: netfilter: add reverse-clash resolution test case
net/netfilter/nf_conntrack_core.c | 56 +++++++-
net/netfilter/nf_nat_core.c | 120 ++++++++++++++++-
.../testing/selftests/net/netfilter/Makefile | 2 +
.../net/netfilter/conntrack_reverse_clash.c | 125 ++++++++++++++++++
.../net/netfilter/conntrack_reverse_clash.sh | 51 +++++++
5 files changed, 347 insertions(+), 7 deletions(-)
create mode 100644 tools/testing/selftests/net/netfilter/conntrack_reverse_clash.c
create mode 100755 tools/testing/selftests/net/netfilter/conntrack_reverse_clash.sh
--
2.44.2
next reply other threads:[~2024-09-10 9:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 9:38 Florian Westphal [this message]
2024-09-10 9:38 ` [PATCH nf-next 1/3] netfilter: nf_nat: don't try nat source port reallocation for reverse dir clash Florian Westphal
2024-09-10 9:38 ` [PATCH nf-next 2/3] netfilter: conntrack: add clash resolution for reverse collisions Florian Westphal
2024-09-10 9:38 ` [PATCH nf-next 3/3] selftests: netfilter: add reverse-clash resolution test case Florian Westphal
2024-09-15 21:11 ` [PATCH nf-next 0/3] netfilter: conntrack: clash resolution for reverse collisions Pablo Neira Ayuso
2024-09-16 8:38 ` Florian Westphal
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=20240910093821.4871-1-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@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