[NETFILTER]: x_tables: switch hotdrop to bool
[safe/jmp/linux-2.6] / include / linux / netfilter / x_tables.h
index 03d1027..b8577d1 100644 (file)
@@ -54,6 +54,14 @@ struct xt_entry_target
        unsigned char data[0];
 };
 
+#define XT_TARGET_INIT(__name, __size)                                        \
+{                                                                             \
+       .target.u.user = {                                                     \
+               .target_size    = XT_ALIGN(__size),                            \
+               .name           = __name,                                      \
+       },                                                                     \
+}
+
 struct xt_standard_target
 {
        struct xt_entry_target target;
@@ -96,22 +104,6 @@ struct _xt_align
 /* Error verdict. */
 #define XT_ERROR_TARGET "ERROR"
 
-/*
- * New IP firewall options for [gs]etsockopt at the RAW IP level.
- * Unlike BSD Linux inherits IP options so you don't have to use a raw
- * socket for this. Instead we check rights in the calls. */
-#define XT_BASE_CTL            64      /* base for firewall socket options */
-
-#define XT_SO_SET_REPLACE      (XT_BASE_CTL)
-#define XT_SO_SET_ADD_COUNTERS (XT_BASE_CTL + 1)
-#define XT_SO_SET_MAX          XT_SO_SET_ADD_COUNTERS
-
-#define XT_SO_GET_INFO                 (XT_BASE_CTL)
-#define XT_SO_GET_ENTRIES              (XT_BASE_CTL + 1)
-#define XT_SO_GET_REVISION_MATCH       (XT_BASE_CTL + 2)
-#define XT_SO_GET_REVISION_TARGET      (XT_BASE_CTL + 3)
-#define XT_SO_GET_MAX                  XT_SO_GET_REVISION_TARGET
-
 #define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
 #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
 
@@ -138,16 +130,6 @@ struct xt_counters_info
 
 #include <linux/netdevice.h>
 
-#define ASSERT_READ_LOCK(x)
-#define ASSERT_WRITE_LOCK(x)
-#include <linux/netfilter_ipv4/listhelp.h>
-
-#ifdef CONFIG_COMPAT
-#define COMPAT_TO_USER         1
-#define COMPAT_FROM_USER       -1
-#define COMPAT_CALC_SIZE       0
-#endif
-
 struct xt_match
 {
        struct list_head list;
@@ -166,7 +148,7 @@ struct xt_match
                     const void *matchinfo,
                     int offset,
                     unsigned int protoff,
-                    int *hotdrop);
+                    bool *hotdrop);
 
        /* Called when user tries to insert an entry of this type. */
        /* Should return true or false. */
@@ -180,7 +162,8 @@ struct xt_match
        void (*destroy)(const struct xt_match *match, void *matchinfo);
 
        /* Called when userspace align differs from kernel space one */
-       int (*compat)(void *match, void **dstptr, int *size, int convert);
+       void (*compat_from_user)(void *dst, void *src);
+       int (*compat_to_user)(void __user *dst, void *src);
 
        /* Set this to THIS_MODULE if you are a module, otherwise NULL */
        struct module *me;
@@ -190,6 +173,7 @@ struct xt_match
 
        char *table;
        unsigned int matchsize;
+       unsigned int compatsize;
        unsigned int hooks;
        unsigned short proto;
 
@@ -228,13 +212,15 @@ struct xt_target
        void (*destroy)(const struct xt_target *target, void *targinfo);
 
        /* Called when userspace align differs from kernel space one */
-       int (*compat)(void *target, void **dstptr, int *size, int convert);
+       void (*compat_from_user)(void *dst, void *src);
+       int (*compat_to_user)(void __user *dst, void *src);
 
        /* Set this to THIS_MODULE if you are a module, otherwise NULL */
        struct module *me;
 
        char *table;
        unsigned int targetsize;
+       unsigned int compatsize;
        unsigned int hooks;
        unsigned short proto;
 
@@ -391,9 +377,18 @@ struct compat_xt_counters_info
 
 extern void xt_compat_lock(int af);
 extern void xt_compat_unlock(int af);
-extern int xt_compat_match(void *match, void **dstptr, int *size, int convert);
-extern int xt_compat_target(void *target, void **dstptr, int *size,
-               int convert);
+
+extern int xt_compat_match_offset(struct xt_match *match);
+extern void xt_compat_match_from_user(struct xt_entry_match *m,
+                                     void **dstptr, int *size);
+extern int xt_compat_match_to_user(struct xt_entry_match *m,
+                                  void __user **dstptr, int *size);
+
+extern int xt_compat_target_offset(struct xt_target *target);
+extern void xt_compat_target_from_user(struct xt_entry_target *t,
+                                      void **dstptr, int *size);
+extern int xt_compat_target_to_user(struct xt_entry_target *t,
+                                   void __user **dstptr, int *size);
 
 #endif /* CONFIG_COMPAT */
 #endif /* __KERNEL__ */