netfilter: fix description of expected checkentry return code on xt_target
[sfrench/cifs-2.6.git] / include / linux / netfilter / x_tables.h
index 50c867256ca34e7f28f185d571b948b9c443062a..c00cc0c4d0b7c29614bbafdfabe73828a04a0fbd 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/types.h>
 
 #define XT_FUNCTION_MAXNAMELEN 30
+#define XT_EXTENSION_MAXNAMELEN 29
 #define XT_TABLE_MAXNAMELEN 32
 
 struct xt_entry_match {
@@ -12,8 +13,7 @@ struct xt_entry_match {
                        __u16 match_size;
 
                        /* Used by userspace */
-                       char name[XT_FUNCTION_MAXNAMELEN-1];
-
+                       char name[XT_EXTENSION_MAXNAMELEN];
                        __u8 revision;
                } user;
                struct {
@@ -36,8 +36,7 @@ struct xt_entry_target {
                        __u16 target_size;
 
                        /* Used by userspace */
-                       char name[XT_FUNCTION_MAXNAMELEN-1];
-
+                       char name[XT_EXTENSION_MAXNAMELEN];
                        __u8 revision;
                } user;
                struct {
@@ -70,8 +69,7 @@ struct xt_standard_target {
 /* The argument to IPT_SO_GET_REVISION_*.  Returns highest revision
  * kernel supports, if >= revision. */
 struct xt_get_revision {
-       char name[XT_FUNCTION_MAXNAMELEN-1];
-
+       char name[XT_EXTENSION_MAXNAMELEN];
        __u8 revision;
 };
 
@@ -185,29 +183,39 @@ struct xt_counters_info {
 #include <linux/netdevice.h>
 
 /**
- * struct xt_match_param - parameters for match extensions' match functions
+ * struct xt_action_param - parameters for matches/targets
  *
+ * @match:     the match extension
+ * @target:    the target extension
+ * @matchinfo: per-match data
+ * @targetinfo:        per-target data
  * @in:                input netdevice
  * @out:       output netdevice
- * @match:     struct xt_match through which this function was invoked
- * @matchinfo: per-match data
  * @fragoff:   packet is a fragment, this is the data offset
  * @thoff:     position of transport header relative to skb->data
  * @hook:      hook number given packet came from
  * @family:    Actual NFPROTO_* through which the function is invoked
  *             (helpful when match->family == NFPROTO_UNSPEC)
+ *
+ * Fields written to by extensions:
+ *
  * @hotdrop:   drop packet if we had inspection problems
  * Network namespace obtainable using dev_net(in/out)
  */
-struct xt_match_param {
+struct xt_action_param {
+       union {
+               const struct xt_match *match;
+               const struct xt_target *target;
+       };
+       union {
+               const void *matchinfo, *targinfo;
+       };
        const struct net_device *in, *out;
-       const struct xt_match *match;
-       const void *matchinfo;
        int fragoff;
        unsigned int thoff;
        unsigned int hooknum;
        u_int8_t family;
-       bool *hotdrop;
+       bool hotdrop;
 };
 
 /**
@@ -244,23 +252,6 @@ struct xt_mtdtor_param {
        u_int8_t family;
 };
 
-/**
- * struct xt_target_param - parameters for target extensions' target functions
- *
- * @hooknum:   hook through which this target was invoked
- * @target:    struct xt_target through which this function was invoked
- * @targinfo:  per-target data
- *
- * Other fields see above.
- */
-struct xt_target_param {
-       const struct net_device *in, *out;
-       const struct xt_target *target;
-       const void *targinfo;
-       unsigned int hooknum;
-       u_int8_t family;
-};
-
 /**
  * struct xt_tgchk_param - parameters for target extensions'
  * checkentry functions
@@ -291,7 +282,7 @@ struct xt_tgdtor_param {
 struct xt_match {
        struct list_head list;
 
-       const char name[XT_FUNCTION_MAXNAMELEN-1];
+       const char name[XT_EXTENSION_MAXNAMELEN];
        u_int8_t revision;
 
        /* Return true or false: return FALSE and set *hotdrop = 1 to
@@ -300,7 +291,7 @@ struct xt_match {
           non-linear skb, using skb_header_pointer and
           skb_ip_make_writable. */
        bool (*match)(const struct sk_buff *skb,
-                     const struct xt_match_param *);
+                     struct xt_action_param *);
 
        /* Called when user tries to insert an entry of this type. */
        int (*checkentry)(const struct xt_mtchk_param *);
@@ -330,19 +321,19 @@ struct xt_match {
 struct xt_target {
        struct list_head list;
 
-       const char name[XT_FUNCTION_MAXNAMELEN-1];
+       const char name[XT_EXTENSION_MAXNAMELEN];
        u_int8_t revision;
 
        /* Returns verdict. Argument order changed since 2.6.9, as this
           must now handle non-linear skbs, using skb_copy_bits and
           skb_ip_make_writable. */
        unsigned int (*target)(struct sk_buff *skb,
-                              const struct xt_target_param *);
+                              const struct xt_action_param *);
 
        /* Called when user tries to insert an entry of this type:
            hook_mask is a bitmask of hooks from which it can be
            called. */
-       /* Should return true or false, or an error code (-Exxxx). */
+       /* Should return 0 on success or an error code otherwise (-Exxxx). */
        int (*checkentry)(const struct xt_tgchk_param *);
 
        /* Called when entry of this type deleted. */