From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: marcmicalizzi@gmail.com, Florian Westphal <fw@strlen.de>
Subject: [PATCH nf 2/5] netfilter: nft_flow_offload: set liberal tracking mode for tcp
Date: Tue, 21 May 2019 13:24:31 +0200 [thread overview]
Message-ID: <20190521112434.11767-3-fw@strlen.de> (raw)
In-Reply-To: <20190521112434.11767-1-fw@strlen.de>
Without it, whenever a packet has to be pushed up the stack (e.g. because
of mtu mismatch), then conntrack will flag packets as invalid, which in
turn breaks NAT.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nft_flow_offload.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index 69d7a8439c7a..bde63d9c3c4e 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -72,6 +72,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
struct nf_flow_route route;
struct flow_offload *flow;
enum ip_conntrack_dir dir;
+ bool is_tcp = false;
struct nf_conn *ct;
int ret;
@@ -84,6 +85,8 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) {
case IPPROTO_TCP:
+ is_tcp = true;
+ break;
case IPPROTO_UDP:
break;
default:
@@ -108,6 +111,11 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
if (!flow)
goto err_flow_alloc;
+ if (is_tcp) {
+ ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
+ ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
+ }
+
ret = flow_offload_add(flowtable, flow);
if (ret < 0)
goto err_flow_add;
--
2.21.0
next prev parent reply other threads:[~2019-05-21 11:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 11:24 [PATCH nf 0/5] netfilter: flow table fixes Florian Westphal
2019-05-21 11:24 ` [PATCH nf 1/5] netfilter: nf_flow_table: ignore DF bit setting Florian Westphal
2019-05-21 11:24 ` Florian Westphal [this message]
2019-05-21 11:24 ` [PATCH nf 3/5] netfilter: nft_flow_offload: don't offload when sequence numbers need adjustment Florian Westphal
2019-05-21 11:24 ` [PATCH nf 4/5] netfilter: nft_flow_offload: IPCB is only valid for ipv4 family Florian Westphal
2019-05-21 11:24 ` [PATCH nf 5/5] selftests: netfilter: add flowtable test script Florian Westphal
2019-05-22 8:55 ` [PATCH nf 0/5] netfilter: flow table fixes 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=20190521112434.11767-3-fw@strlen.de \
--to=fw@strlen.de \
--cc=marcmicalizzi@gmail.com \
--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).