[PATCH nf-next] netfilter: ip6_tables: replace the loop with xt_entry_foreach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We already have an iterator in the form of
xt_entry_foreach macro.

Signed-off-by: Denis Kirjanov <kirjanov@xxxxxxxxx>
---
 net/ipv6/netfilter/ip6_tables.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 7d5602950ae7..84effcf4ff98 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -840,14 +840,12 @@ copy_entries_to_user(unsigned int total_size,
 
 	loc_cpu_entry = private->entries;
 
-	/* FIXME: use iterator macros --RR */
-	/* ... then go back and fix counters and names */
-	for (off = 0, num = 0; off < total_size; off += e->next_offset, num++){
+	num = 0;
+	xt_entry_foreach(e, loc_cpu_entry, total_size) {
 		unsigned int i;
 		const struct xt_entry_match *m;
 		const struct xt_entry_target *t;
 
-		e = loc_cpu_entry + off;
 		if (copy_to_user(userptr + off, e, sizeof(*e))) {
 			ret = -EFAULT;
 			goto free_counters;
-- 
2.47.2





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux