Skip to contentSkip to conversation

netfilter: flowtable: fetch stats only if flow is still alive

PATCH Superseded Pablo Neira Ayuso 1 participant 1 message Jan 5, 2020

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: flowtable: fetch stats only if flow is still alive

Do not fetch statistics if flow has expired since it might not in hardware anymore.

---
 net/netfilter/nf_flow_table_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
net/netfilter/nf_flow_table_core.c +2 -3
index e33a73cb1f42..9e6de2bbeccb 100644
@@ -348,9 +348,6 @@ static void nf_flow_offload_gc_step(struct flow_offload *flow, void *data)
 {
 	struct nf_flowtable *flow_table = data;
 
-	if (flow->flags & FLOW_OFFLOAD_HW)
-		nf_flow_offload_stats(flow_table, flow);
-
 	if (nf_flow_has_expired(flow) || nf_ct_is_dying(flow->ct) ||
 	    (flow->flags & (FLOW_OFFLOAD_DYING | FLOW_OFFLOAD_TEARDOWN))) {
 		if (flow->flags & FLOW_OFFLOAD_HW) {
@@ -361,6 +358,8 @@ static void nf_flow_offload_gc_step(struct flow_offload *flow, void *data)
 		} else {
 			flow_offload_del(flow_table, flow);
 		}
+	} else if (flow->flags & FLOW_OFFLOAD_HW) {
+		nf_flow_offload_stats(flow_table, flow);
 	}
 }
 
Signature · 1 line
2.11.0