netfilter: xtables: replace XT_MATCH_ITERATE macro
The macro is replaced by a list.h-like foreach loop. This makes the code more inspectable. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
committed by
Patrick McHardy
parent
0559518b5b
commit
dcea992aca
@@ -120,6 +120,7 @@ struct xt_counters_info {
|
||||
|
||||
#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
|
||||
|
||||
#ifndef __KERNEL__
|
||||
/* fn returns 0 to continue iteration */
|
||||
#define XT_MATCH_ITERATE(type, e, fn, args...) \
|
||||
({ \
|
||||
@@ -139,7 +140,6 @@ struct xt_counters_info {
|
||||
__ret; \
|
||||
})
|
||||
|
||||
#ifndef __KERNEL__
|
||||
/* fn returns 0 to continue iteration */
|
||||
#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \
|
||||
({ \
|
||||
@@ -172,6 +172,14 @@ struct xt_counters_info {
|
||||
(pos) < (typeof(pos))((char *)(ehead) + (esize)); \
|
||||
(pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
|
||||
|
||||
/* can only be xt_entry_match, so no use of typeof here */
|
||||
#define xt_ematch_foreach(pos, entry) \
|
||||
for ((pos) = (struct xt_entry_match *)entry->elems; \
|
||||
(pos) < (struct xt_entry_match *)((char *)(entry) + \
|
||||
(entry)->target_offset); \
|
||||
(pos) = (struct xt_entry_match *)((char *)(pos) + \
|
||||
(pos)->u.match_size))
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
|
Reference in New Issue
Block a user