Skip to contentSkip to conversation

netfilter: flowtable: set on NF_FLOW_HW once flow has been offloaded

PATCH New Pablo Neira Ayuso 1 participant 1 message Oct 4

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: flowtable: set on NF_FLOW_HW once flow has been offloaded

Sashiko reports that refreshing hw offload from packet path is racy since flow might be already going away. Since commit 7c549fb7eecd ("netfilter: flowtable: generalize pending status bit"), GC skips flow entries that are still pending to be offloaded. Set on NF_FLOW_HW flag once the flow entry has been offloaded.

Fixes 8b3646d6e0c4 ("net/sched: act_ct: Support refreshing the flow table entries")
---
 net/netfilter/nf_flow_table_core.c    | 2 +-
 net/netfilter/nf_flow_table_offload.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
net/netfilter/nf_flow_table_core.c +1 -1
index 36bbc7be2f74..3603e72a662c 100644
@@ -379,7 +379,7 @@ void flow_offload_refresh(struct nf_flowtable *flow_table,
 	    test_bit(NF_FLOW_CLOSING, &flow->flags))
 		return;
 
-	if (test_bit(NF_FLOW_HW, &flow->flags))
+	if (!test_bit(NF_FLOW_HW, &flow->flags))
 		nf_flow_offload_refresh(flow_table, flow);
 }
 EXPORT_SYMBOL_GPL(flow_offload_refresh);
net/netfilter/nf_flow_table_offload.c +1 -2
index 4365859220e6..c40e17bd91a4 100644
@@ -984,7 +984,7 @@ static void flow_offload_work_add(struct flow_offload_work *offload)
 		goto out;
 
 	set_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status);
-
+	set_bit(NF_FLOW_HW, &offload->flow->flags);
 out:
 	nf_flow_offload_destroy(flow_rule);
 }
@@ -1129,7 +1129,6 @@ void nf_flow_offload_add(struct nf_flowtable *flowtable,
 	if (nf_flow_offload_unsupported(flow))
 		return;
 
-	set_bit(NF_FLOW_HW, &flow->flags);
 	nf_flow_offload_refresh(flowtable, flow);
 }
 
Signature · 1 line
2.47.3