aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netfilter/x_tables.h
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2010-02-24 18:32:59 +0100
committerPatrick McHardy <kaber@trash.net>2010-02-24 18:32:59 +0100
commit72b2b1dd77e8feb0b7c0b26dee58f2a1e2c9828c (patch)
tree4289fef5441a1664f60a17cb473d657f77cf1112 /include/linux/netfilter/x_tables.h
parent8ccb92ad41cb311e52ad1b1fe77992c7f47a3b63 (diff)
downloadlinux-72b2b1dd77e8feb0b7c0b26dee58f2a1e2c9828c.tar.gz
netfilter: xtables: replace XT_ENTRY_ITERATE macro
The macro is replaced by a list.h-like foreach loop. This makes the code much more inspectable. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/linux/netfilter/x_tables.h')
-rw-r--r--include/linux/netfilter/x_tables.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index a18119fb88f07c..9df3f5a8f9f7c9 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -139,6 +139,7 @@ struct xt_counters_info {
__ret; \
})
+#ifndef __KERNEL__
/* fn returns 0 to continue iteration */
#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \
({ \
@@ -163,6 +164,14 @@ struct xt_counters_info {
#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \
XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
+#endif /* !__KERNEL__ */
+
+/* pos is normally a struct ipt_entry/ip6t_entry/etc. */
+#define xt_entry_foreach(pos, ehead, esize) \
+ for ((pos) = (typeof(pos))(ehead); \
+ (pos) < (typeof(pos))((char *)(ehead) + (esize)); \
+ (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
+
#ifdef __KERNEL__
#include <linux/netdevice.h>