Skip to contentSkip to conversation

netfilter: nf_conntrack_tcp: skip tracking for offloaded packets

PATCH In review Pablo Neira Ayuso 2 participants 2 messages Mar 18, 2022

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_conntrack_tcp: skip tracking for offloaded packets

Sometimes flowtable datapath passes up packets to classic forwarding path, eg. mtu exceeded case. Skip TCP tracking otherwise these packets are considered invalid by conntrack.

Fixes ac2a66665e23 ("netfilter: add generic flow table infrastructure")

---
This is a fix, but I'm routing it through nf-next at this stage.

 net/netfilter/nf_conntrack_proto_tcp.c | 3 +++
 1 file changed, 3 insertions(+)
net/netfilter/nf_conntrack_proto_tcp.c +3 -0
index d1582b888c0d..e0a1f86910ec 100644
@@ -889,6 +889,9 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct,
 	if (!nf_ct_is_confirmed(ct) && !tcp_new(ct, skb, dataoff, th))
 		return -NF_ACCEPT;
 
+	if (unlikely(test_bit(IPS_OFFLOAD_BIT, &ct->status)))
+		return NF_ACCEPT;
+
 	spin_lock_bh(&ct->lock);
 	old_state = ct->proto.tcp.state;
 	dir = CTINFO2DIR(ctinfo);
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 3 lines · Pablo Neira Ayuso

Sometimes flowtable datapath passes up packets to classic forwarding path, eg. mtu exceeded case. Skip TCP tracking otherwise these packets are considered invalid by conntrack.

They are? nft_flow_offload_eval() sets IP_CT_TCP_FLAG_BE_LIBERAL for the conntrack, so at least window checks are disabled.