]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/netfilter_arp/arp_tables.h
h63xx: nfs mount works, gpe image boots to ts config screen.
[linux-2.6-omap-h63xx.git] / include / linux / netfilter_arp / arp_tables.h
index 2fc73fa8e37f859fbeec4948e7ab009ef0e1a333..590ac3d6d5d67e349b28a146be534d14cefa29c3 100644 (file)
 
 #ifdef __KERNEL__
 #include <linux/if.h>
-#include <linux/types.h>
 #include <linux/in.h>
 #include <linux/if_arp.h>
 #include <linux/skbuff.h>
 #endif
+#include <linux/types.h>
 #include <linux/compiler.h>
 #include <linux/netfilter_arp.h>
 
@@ -23,8 +23,6 @@
 
 #define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
 #define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
-#define arpt_target xt_target
-#define arpt_table xt_table
 
 #define ARPT_DEV_ADDR_LEN_MAX 16
 
@@ -217,21 +215,8 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e
 }
 
 /* fn returns 0 to continue iteration */
-#define ARPT_ENTRY_ITERATE(entries, size, fn, args...)         \
-({                                                             \
-       unsigned int __i;                                       \
-       int __ret = 0;                                          \
-       struct arpt_entry *__entry;                             \
-                                                               \
-       for (__i = 0; __i < (size); __i += __entry->next_offset) { \
-               __entry = (void *)(entries) + __i;              \
-                                                               \
-               __ret = fn(__entry , ## args);                  \
-               if (__ret != 0)                                 \
-                       break;                                  \
-       }                                                       \
-       __ret;                                                  \
-})
+#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
+       XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
 
 /*
  *     Main firewall chains definitions and global var's definitions.
@@ -279,20 +264,47 @@ struct arpt_error
        .target.errorname = "ERROR",                                           \
 }
 
-#define arpt_register_target(tgt)      \
-({     (tgt)->family = NF_ARP;         \
-       xt_register_target(tgt); })
-#define arpt_unregister_target(tgt) xt_unregister_target(tgt)
-
-extern int arpt_register_table(struct arpt_table *table,
-                              const struct arpt_replace *repl);
-extern void arpt_unregister_table(struct arpt_table *table);
+extern struct xt_table *arpt_register_table(struct net *net,
+                                           struct xt_table *table,
+                                           const struct arpt_replace *repl);
+extern void arpt_unregister_table(struct xt_table *table);
 extern unsigned int arpt_do_table(struct sk_buff *skb,
                                  unsigned int hook,
                                  const struct net_device *in,
                                  const struct net_device *out,
-                                 struct arpt_table *table);
+                                 struct xt_table *table);
+
+#define ARPT_ALIGN(s) XT_ALIGN(s)
+
+#ifdef CONFIG_COMPAT
+#include <net/compat.h>
+
+struct compat_arpt_entry
+{
+       struct arpt_arp arp;
+       u_int16_t target_offset;
+       u_int16_t next_offset;
+       compat_uint_t comefrom;
+       struct compat_xt_counters counters;
+       unsigned char elems[0];
+};
+
+static inline struct arpt_entry_target *
+compat_arpt_get_target(struct compat_arpt_entry *e)
+{
+       return (void *)e + e->target_offset;
+}
+
+#define COMPAT_ARPT_ALIGN(s)   COMPAT_XT_ALIGN(s)
+
+/* fn returns 0 to continue iteration */
+#define COMPAT_ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
+       XT_ENTRY_ITERATE(struct compat_arpt_entry, entries, size, fn, ## args)
+
+#define COMPAT_ARPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
+       XT_ENTRY_ITERATE_CONTINUE(struct compat_arpt_entry, entries, size, n, \
+                                 fn, ## args)
 
-#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1))
+#endif /* CONFIG_COMPAT */
 #endif /*__KERNEL__*/
 #endif /* _ARPTABLES_H */