]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/netfilter/x_tables.h
Merge branch 'master' of git://dev.medozas.de/linux
[net-next-2.6.git] / include / linux / netfilter / x_tables.h
index 378f27ae7772f197c8a99afc99f0f78fa3addb3a..a0a144a6c6d939f50685350020799e785b21546e 100644 (file)
@@ -93,8 +93,7 @@ struct _xt_align {
        __u64 u64;
 };
 
-#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1))         \
-                       & ~(__alignof__(struct _xt_align)-1))
+#define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align))
 
 /* Standard return verdict, or do jump. */
 #define XT_STANDARD_TARGET ""
@@ -205,6 +204,7 @@ struct xt_match_param {
  * @hook_mask: via which hooks the new rule is reachable
  */
 struct xt_mtchk_param {
+       struct net *net;
        const char *table;
        const void *entryinfo;
        const struct xt_match *match;
@@ -215,6 +215,7 @@ struct xt_mtchk_param {
 
 /* Match destructor parameters */
 struct xt_mtdtor_param {
+       struct net *net;
        const struct xt_match *match;
        void *matchinfo;
        u_int8_t family;
@@ -247,6 +248,7 @@ struct xt_target_param {
  * Other fields see above.
  */
 struct xt_tgchk_param {
+       struct net *net;
        const char *table;
        const void *entryinfo;
        const struct xt_target *target;
@@ -257,6 +259,7 @@ struct xt_tgchk_param {
 
 /* Target destructor parameters */
 struct xt_tgdtor_param {
+       struct net *net;
        const struct xt_target *target;
        void *targinfo;
        u_int8_t family;
@@ -281,11 +284,11 @@ struct xt_match {
 
        /* Called when entry of this type deleted. */
        void (*destroy)(const struct xt_mtdtor_param *);
-
+#ifdef CONFIG_COMPAT
        /* Called when userspace align differs from kernel space one */
        void (*compat_from_user)(void *dst, void *src);
        int (*compat_to_user)(void __user *dst, void *src);
-
+#endif
        /* Set this to THIS_MODULE if you are a module, otherwise NULL */
        struct module *me;
 
@@ -294,7 +297,9 @@ struct xt_match {
 
        const char *table;
        unsigned int matchsize;
+#ifdef CONFIG_COMPAT
        unsigned int compatsize;
+#endif
        unsigned int hooks;
        unsigned short proto;
 
@@ -321,17 +326,19 @@ struct xt_target {
 
        /* Called when entry of this type deleted. */
        void (*destroy)(const struct xt_tgdtor_param *);
-
+#ifdef CONFIG_COMPAT
        /* Called when userspace align differs from kernel space one */
        void (*compat_from_user)(void *dst, void *src);
        int (*compat_to_user)(void __user *dst, void *src);
-
+#endif
        /* Set this to THIS_MODULE if you are a module, otherwise NULL */
        struct module *me;
 
        const char *table;
        unsigned int targetsize;
+#ifdef CONFIG_COMPAT
        unsigned int compatsize;
+#endif
        unsigned int hooks;
        unsigned short proto;
 
@@ -353,6 +360,7 @@ struct xt_table {
        struct module *me;
 
        u_int8_t af;            /* address/protocol family */
+       int priority;           /* hook order */
 
        /* A unique name... */
        const char name[XT_TABLE_MAXNAMELEN];
@@ -514,6 +522,9 @@ static inline unsigned long ifname_compare_aligned(const char *_a,
        return ret;
 }
 
+extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *);
+extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *);
+
 #ifdef CONFIG_COMPAT
 #include <net/compat.h>
 
@@ -554,11 +565,7 @@ struct compat_xt_entry_target {
  * current task alignment */
 
 struct compat_xt_counters {
-#if defined(CONFIG_X86_64) || defined(CONFIG_IA64)
-       u_int32_t cnt[4];
-#else
-       u_int64_t cnt[2];
-#endif
+       compat_u64 pcnt, bcnt;                  /* Packet and byte counters */
 };
 
 struct compat_xt_counters_info {
@@ -567,8 +574,14 @@ struct compat_xt_counters_info {
        struct compat_xt_counters counters[0];
 };
 
-#define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \
-               & ~(__alignof__(struct compat_xt_counters)-1))
+struct _compat_xt_align {
+       __u8 u8;
+       __u16 u16;
+       __u32 u32;
+       compat_u64 u64;
+};
+
+#define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align))
 
 extern void xt_compat_lock(u_int8_t af);
 extern void xt_compat_unlock(u_int8_t af);