Skip to content

Commit 8437a62

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nft_flow_offload: set liberal tracking mode for tcp
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> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent e75b3e1 commit 8437a62

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

net/netfilter/nft_flow_offload.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
7272
struct nf_flow_route route;
7373
struct flow_offload *flow;
7474
enum ip_conntrack_dir dir;
75+
bool is_tcp = false;
7576
struct nf_conn *ct;
7677
int ret;
7778

@@ -84,6 +85,8 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
8485

8586
switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) {
8687
case IPPROTO_TCP:
88+
is_tcp = true;
89+
break;
8790
case IPPROTO_UDP:
8891
break;
8992
default:
@@ -108,6 +111,11 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
108111
if (!flow)
109112
goto err_flow_alloc;
110113

114+
if (is_tcp) {
115+
ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
116+
ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
117+
}
118+
111119
ret = flow_offload_add(flowtable, flow);
112120
if (ret < 0)
113121
goto err_flow_add;

0 commit comments

Comments
 (0)