From: Pablo Neira Ayuso <pablo@netfilter.org>
Update this iterator to return the number of entries in this flowtable.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Paul Blakey <redacted>
---
net/netfilter/nf_flow_table_core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index face98b..83bc456 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -319,7 +319,7 @@ struct flow_offload_tuple_rhash *
struct flow_offload_tuple_rhash *tuplehash;
struct rhashtable_iter hti;
struct flow_offload *flow;
- int err = 0;
+ int err = 0, cnt = 0;
rhashtable_walk_enter(&flow_table->rhashtable, &hti);
rhashtable_walk_start(&hti);
@@ -338,11 +338,12 @@ struct flow_offload_tuple_rhash *
flow = container_of(tuplehash, struct flow_offload, tuplehash[0]);
iter(flow_table, flow, data);
+ cnt++;
}
rhashtable_walk_stop(&hti);
rhashtable_walk_exit(&hti);
- return err;
+ return err < 0 ? err : cnt;
}
static void nf_flow_offload_gc_step(struct nf_flowtable *flow_table,
--
1.8.3.1