From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: kadlec@netfilter.org, Florian Westphal <fw@strlen.de>
Subject: [PATCH nf-next 0/2] netfilter: conntrack: do not renew timeout while in tcp SYN_SENT state
Date: Thu, 24 Jun 2021 12:36:40 +0200 [thread overview]
Message-ID: <20210624103642.29087-1-fw@strlen.de> (raw)
Antonio Ojea reported a problem with a container environment where
connection retries prevent expiry of a SYN_SENT conntrack entry.
This in turn prevents a NAT rule from becoming active.
Consider:
client -----> conntrack ---> Host
client sends a SYN, but $Host is unreachable/silent.
In the reported case, $host address doesn't exist at all --
its a 'virtual' ip that is made accessible via dnat/redirect.
The routing table even passes the packet back via the same interface
it arrived on.
In the mean time, a NAT rule has been added to the conntrack
namespace, but it has no effect until the existing conntrack
entry times out.
Unfortunately, in the above scenario, the client retries reconnects
faster than the SYN default timeout (60 seconds), i.e. the entry
never expires and the 'virtual' ip never becomes active.
First patch adds a test case:
3 namespaces, one sender, one receiver.
sender connects to non-existent/virtual ip.
Then a dnat rule gets added.
The test case succeeds once conntrack tool shows that the nat rule
was evaluated.
Second patch prevents timeout refresh for entries stuck in
SYN_SENT state.
Without second patch the test case doesn't pass even though syn
timeout is set to 10 seconds.
Florian Westphal (2):
selftest: netfilter: add test case for unreplied tcp connections
netfilter: conntrack: do not renew entry stuck in tcp SYN_SENT state
net/netfilter/nf_conntrack_proto_tcp.c | 10 ++
tools/testing/selftests/netfilter/Makefile | 2 +-
.../netfilter/conntrack_tcp_unreplied.sh | 167 ++++++++++++++++++
3 files changed, 178 insertions(+), 1 deletion(-)
create mode 100755 tools/testing/selftests/netfilter/conntrack_tcp_unreplied.sh
--
2.31.1
next reply other threads:[~2021-06-24 10:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 10:36 Florian Westphal [this message]
2021-06-24 10:36 ` [PATCH nf-next 1/2] selftest: netfilter: add test case for unreplied tcp connections Florian Westphal
2021-06-24 10:36 ` [PATCH nf-next 2/2] netfilter: conntrack: do not renew entry stuck in tcp SYN_SENT state Florian Westphal
2021-07-02 0:53 ` [PATCH nf-next 0/2] netfilter: conntrack: do not renew timeout while " Pablo Neira Ayuso
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=20210624103642.29087-1-fw@strlen.de \
--to=fw@strlen.de \
--cc=kadlec@netfilter.org \
--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;
as well as URLs for NNTP newsgroup(s).