]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
include: refresh include files from kernel 3.1-rc3
authorJan Engelhardt <jengelh@medozas.de>
Sun, 28 Aug 2011 12:19:43 +0000 (14:19 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Wed, 31 Aug 2011 12:07:43 +0000 (14:07 +0200)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
40 files changed:
include/linux/kernel.h
include/linux/netfilter.h
include/linux/netfilter/ipset/ip_set.h [new file with mode: 0644]
include/linux/netfilter/nf_conntrack_common.h
include/linux/netfilter/nf_conntrack_tuple_common.h
include/linux/netfilter/x_tables.h
include/linux/netfilter/xt_CT.h
include/linux/netfilter/xt_TCPOPTSTRIP.h
include/linux/netfilter/xt_TPROXY.h
include/linux/netfilter/xt_cluster.h
include/linux/netfilter/xt_connbytes.h
include/linux/netfilter/xt_connlimit.h
include/linux/netfilter/xt_physdev.h
include/linux/netfilter/xt_policy.h
include/linux/netfilter/xt_quota.h
include/linux/netfilter/xt_sctp.h
include/linux/netfilter/xt_set.h
include/linux/netfilter/xt_socket.h
include/linux/netfilter/xt_time.h
include/linux/netfilter/xt_u32.h
include/linux/netfilter_ipv4/ip_tables.h
include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
include/linux/netfilter_ipv4/ipt_ECN.h
include/linux/netfilter_ipv4/ipt_SAME.h
include/linux/netfilter_ipv4/ipt_TTL.h
include/linux/netfilter_ipv4/ipt_addrtype.h
include/linux/netfilter_ipv4/ipt_ah.h
include/linux/netfilter_ipv4/ipt_ecn.h
include/linux/netfilter_ipv4/ipt_ttl.h
include/linux/netfilter_ipv6/ip6_tables.h
include/linux/netfilter_ipv6/ip6t_HL.h
include/linux/netfilter_ipv6/ip6t_REJECT.h
include/linux/netfilter_ipv6/ip6t_ah.h
include/linux/netfilter_ipv6/ip6t_frag.h
include/linux/netfilter_ipv6/ip6t_hl.h
include/linux/netfilter_ipv6/ip6t_ipv6header.h
include/linux/netfilter_ipv6/ip6t_mh.h
include/linux/netfilter_ipv6/ip6t_opts.h
include/linux/netfilter_ipv6/ip6t_rt.h
include/linux/types.h

index d1671a01f5b49c68e69caa4f1ba3744586c2eafc..d4c59f6557d355bfc4e56e3834d57107d247f0f5 100644 (file)
@@ -8,7 +8,6 @@
 #define __ALIGN_KERNEL_MASK(x, mask)   (((x) + (mask)) & ~(mask))
 
 
-
 #define SI_LOAD_SHIFT  16
 struct sysinfo {
        long uptime;                    /* Seconds since boot */
@@ -27,36 +26,4 @@ struct sysinfo {
        char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
 };
 
-/* Force a compilation error if condition is true */
-#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
-
-/* Force a compilation error if condition is constant and true */
-#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
-
-/* Force a compilation error if a constant expression is not a power of 2 */
-#define BUILD_BUG_ON_NOT_POWER_OF_2(n)                 \
-       BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
-
-/* Force a compilation error if condition is true, but also produce a
-   result (of value 0 and type size_t), so the expression can be used
-   e.g. in a structure initializer (or where-ever else comma expressions
-   aren't permitted). */
-#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
-#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
-
-/* Trap pasters of __FUNCTION__ at compile-time */
-#define __FUNCTION__ (__func__)
-
-/* This helps us to avoid #ifdef CONFIG_NUMA */
-#ifdef CONFIG_NUMA
-#define NUMA_BUILD 1
-#else
-#define NUMA_BUILD 0
-#endif
-
-/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
-#ifdef CONFIG_FTRACE_MCOUNT_RECORD
-# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
-#endif
-
 #endif
index 2eb00b6c39569f0fc178bbb199ad941694730f10..54771312ff0743ab6f34f16231a18ad112ad01aa 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <linux/types.h>
 
+#include <linux/sysctl.h>
 
 /* Responses from hook functions. */
 #define NF_DROP 0
 #define NF_MAX_VERDICT NF_STOP
 
 /* we overload the higher bits for encoding auxiliary data such as the queue
- * number. Not nice, but better than additional function arguments. */
-#define NF_VERDICT_MASK 0x0000ffff
-#define NF_VERDICT_BITS 16
+ * number or errno values. Not nice, but better than additional function
+ * arguments. */
+#define NF_VERDICT_MASK 0x000000ff
+
+/* extra verdict flags have mask 0x0000ff00 */
+#define NF_VERDICT_FLAG_QUEUE_BYPASS   0x00008000
 
+/* queue number (NF_QUEUE) or errno (NF_DROP) */
 #define NF_VERDICT_QMASK 0xffff0000
 #define NF_VERDICT_QBITS 16
 
-#define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE)
+#define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE)
+
+#define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP)
 
 /* only for userspace compatibility */
 /* Generic cache responses from hook functions.
@@ -29,6 +36,9 @@
 #define NFC_UNKNOWN 0x4000
 #define NFC_ALTERED 0x8000
 
+/* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */
+#define NF_VERDICT_BITS 16
+
 enum nf_inet_hooks {
        NF_INET_PRE_ROUTING,
        NF_INET_LOCAL_IN,
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
new file mode 100644 (file)
index 0000000..79cb077
--- /dev/null
@@ -0,0 +1,225 @@
+#ifndef _IP_SET_H
+#define _IP_SET_H
+
+/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>
+ *                         Patrick Schaaf <bof@bof.de>
+ *                         Martin Josefsson <gandalf@wlug.westbo.se>
+ * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/types.h>
+
+/* The protocol version */
+#define IPSET_PROTOCOL         6
+
+/* The max length of strings including NUL: set and type identifiers */
+#define IPSET_MAXNAMELEN       32
+
+/* Message types and commands */
+enum ipset_cmd {
+       IPSET_CMD_NONE,
+       IPSET_CMD_PROTOCOL,     /* 1: Return protocol version */
+       IPSET_CMD_CREATE,       /* 2: Create a new (empty) set */
+       IPSET_CMD_DESTROY,      /* 3: Destroy a (empty) set */
+       IPSET_CMD_FLUSH,        /* 4: Remove all elements from a set */
+       IPSET_CMD_RENAME,       /* 5: Rename a set */
+       IPSET_CMD_SWAP,         /* 6: Swap two sets */
+       IPSET_CMD_LIST,         /* 7: List sets */
+       IPSET_CMD_SAVE,         /* 8: Save sets */
+       IPSET_CMD_ADD,          /* 9: Add an element to a set */
+       IPSET_CMD_DEL,          /* 10: Delete an element from a set */
+       IPSET_CMD_TEST,         /* 11: Test an element in a set */
+       IPSET_CMD_HEADER,       /* 12: Get set header data only */
+       IPSET_CMD_TYPE,         /* 13: Get set type */
+       IPSET_MSG_MAX,          /* Netlink message commands */
+
+       /* Commands in userspace: */
+       IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */
+       IPSET_CMD_HELP,         /* 15: Get help */
+       IPSET_CMD_VERSION,      /* 16: Get program version */
+       IPSET_CMD_QUIT,         /* 17: Quit from interactive mode */
+
+       IPSET_CMD_MAX,
+
+       IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */
+};
+
+/* Attributes at command level */
+enum {
+       IPSET_ATTR_UNSPEC,
+       IPSET_ATTR_PROTOCOL,    /* 1: Protocol version */
+       IPSET_ATTR_SETNAME,     /* 2: Name of the set */
+       IPSET_ATTR_TYPENAME,    /* 3: Typename */
+       IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */
+       IPSET_ATTR_REVISION,    /* 4: Settype revision */
+       IPSET_ATTR_FAMILY,      /* 5: Settype family */
+       IPSET_ATTR_FLAGS,       /* 6: Flags at command level */
+       IPSET_ATTR_DATA,        /* 7: Nested attributes */
+       IPSET_ATTR_ADT,         /* 8: Multiple data containers */
+       IPSET_ATTR_LINENO,      /* 9: Restore lineno */
+       IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */
+       IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */
+       __IPSET_ATTR_CMD_MAX,
+};
+#define IPSET_ATTR_CMD_MAX     (__IPSET_ATTR_CMD_MAX - 1)
+
+/* CADT specific attributes */
+enum {
+       IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1,
+       IPSET_ATTR_IP_FROM = IPSET_ATTR_IP,
+       IPSET_ATTR_IP_TO,       /* 2 */
+       IPSET_ATTR_CIDR,        /* 3 */
+       IPSET_ATTR_PORT,        /* 4 */
+       IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT,
+       IPSET_ATTR_PORT_TO,     /* 5 */
+       IPSET_ATTR_TIMEOUT,     /* 6 */
+       IPSET_ATTR_PROTO,       /* 7 */
+       IPSET_ATTR_CADT_FLAGS,  /* 8 */
+       IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO,     /* 9 */
+       /* Reserve empty slots */
+       IPSET_ATTR_CADT_MAX = 16,
+       /* Create-only specific attributes */
+       IPSET_ATTR_GC,
+       IPSET_ATTR_HASHSIZE,
+       IPSET_ATTR_MAXELEM,
+       IPSET_ATTR_NETMASK,
+       IPSET_ATTR_PROBES,
+       IPSET_ATTR_RESIZE,
+       IPSET_ATTR_SIZE,
+       /* Kernel-only */
+       IPSET_ATTR_ELEMENTS,
+       IPSET_ATTR_REFERENCES,
+       IPSET_ATTR_MEMSIZE,
+
+       __IPSET_ATTR_CREATE_MAX,
+};
+#define IPSET_ATTR_CREATE_MAX  (__IPSET_ATTR_CREATE_MAX - 1)
+
+/* ADT specific attributes */
+enum {
+       IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1,
+       IPSET_ATTR_NAME,
+       IPSET_ATTR_NAMEREF,
+       IPSET_ATTR_IP2,
+       IPSET_ATTR_CIDR2,
+       IPSET_ATTR_IP2_TO,
+       IPSET_ATTR_IFACE,
+       __IPSET_ATTR_ADT_MAX,
+};
+#define IPSET_ATTR_ADT_MAX     (__IPSET_ATTR_ADT_MAX - 1)
+
+/* IP specific attributes */
+enum {
+       IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1,
+       IPSET_ATTR_IPADDR_IPV6,
+       __IPSET_ATTR_IPADDR_MAX,
+};
+#define IPSET_ATTR_IPADDR_MAX  (__IPSET_ATTR_IPADDR_MAX - 1)
+
+/* Error codes */
+enum ipset_errno {
+       IPSET_ERR_PRIVATE = 4096,
+       IPSET_ERR_PROTOCOL,
+       IPSET_ERR_FIND_TYPE,
+       IPSET_ERR_MAX_SETS,
+       IPSET_ERR_BUSY,
+       IPSET_ERR_EXIST_SETNAME2,
+       IPSET_ERR_TYPE_MISMATCH,
+       IPSET_ERR_EXIST,
+       IPSET_ERR_INVALID_CIDR,
+       IPSET_ERR_INVALID_NETMASK,
+       IPSET_ERR_INVALID_FAMILY,
+       IPSET_ERR_TIMEOUT,
+       IPSET_ERR_REFERENCED,
+       IPSET_ERR_IPADDR_IPV4,
+       IPSET_ERR_IPADDR_IPV6,
+
+       /* Type specific error codes */
+       IPSET_ERR_TYPE_SPECIFIC = 4352,
+};
+
+/* Flags at command level */
+enum ipset_cmd_flags {
+       IPSET_FLAG_BIT_EXIST    = 0,
+       IPSET_FLAG_EXIST        = (1 << IPSET_FLAG_BIT_EXIST),
+       IPSET_FLAG_BIT_LIST_SETNAME = 1,
+       IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME),
+       IPSET_FLAG_BIT_LIST_HEADER = 2,
+       IPSET_FLAG_LIST_HEADER  = (1 << IPSET_FLAG_BIT_LIST_HEADER),
+};
+
+/* Flags at CADT attribute level */
+enum ipset_cadt_flags {
+       IPSET_FLAG_BIT_BEFORE   = 0,
+       IPSET_FLAG_BEFORE       = (1 << IPSET_FLAG_BIT_BEFORE),
+       IPSET_FLAG_BIT_PHYSDEV  = 1,
+       IPSET_FLAG_PHYSDEV      = (1 << IPSET_FLAG_BIT_PHYSDEV),
+};
+
+/* Commands with settype-specific attributes */
+enum ipset_adt {
+       IPSET_ADD,
+       IPSET_DEL,
+       IPSET_TEST,
+       IPSET_ADT_MAX,
+       IPSET_CREATE = IPSET_ADT_MAX,
+       IPSET_CADT_MAX,
+};
+
+/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
+ * and IPSET_INVALID_ID if you want to increase the max number of sets.
+ */
+typedef __u16 ip_set_id_t;
+
+#define IPSET_INVALID_ID               65535
+
+enum ip_set_dim {
+       IPSET_DIM_ZERO = 0,
+       IPSET_DIM_ONE,
+       IPSET_DIM_TWO,
+       IPSET_DIM_THREE,
+       /* Max dimension in elements.
+        * If changed, new revision of iptables match/target is required.
+        */
+       IPSET_DIM_MAX = 6,
+};
+
+/* Option flags for kernel operations */
+enum ip_set_kopt {
+       IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO),
+       IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE),
+       IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO),
+       IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
+};
+
+
+/* Interface to iptables/ip6tables */
+
+#define SO_IP_SET              83
+
+union ip_set_name_index {
+       char name[IPSET_MAXNAMELEN];
+       ip_set_id_t index;
+};
+
+#define IP_SET_OP_GET_BYNAME   0x00000006      /* Get set index by name */
+struct ip_set_req_get_set {
+       unsigned op;
+       unsigned version;
+       union ip_set_name_index set;
+};
+
+#define IP_SET_OP_GET_BYINDEX  0x00000007      /* Get set name by index */
+/* Uses ip_set_req_get_set */
+
+#define IP_SET_OP_VERSION      0x00000100      /* Ask kernel version */
+struct ip_set_req_version {
+       unsigned op;
+       unsigned version;
+};
+
+#endif /*_IP_SET_H */
index 34a7fc6596ef7ca6dbf385c6ebd9448e7fa8fe19..38aa52d7beea03f210597d3c0d445b2db64ce8fe 100644 (file)
@@ -18,6 +18,9 @@ enum ip_conntrack_info {
        /* >= this indicates reply direction */
        IP_CT_IS_REPLY,
 
+       IP_CT_ESTABLISHED_REPLY = IP_CT_ESTABLISHED + IP_CT_IS_REPLY,
+       IP_CT_RELATED_REPLY = IP_CT_RELATED + IP_CT_IS_REPLY,
+       IP_CT_NEW_REPLY = IP_CT_NEW + IP_CT_IS_REPLY,   
        /* Number of distinct IP_CT types (no NEW in reply dirn). */
        IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
 };
@@ -76,6 +79,10 @@ enum ip_conntrack_status {
        /* Conntrack is a template */
        IPS_TEMPLATE_BIT = 11,
        IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT),
+
+       /* Conntrack is a fake untracked entry */
+       IPS_UNTRACKED_BIT = 12,
+       IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
 };
 
 /* Connection tracking event types */
@@ -94,6 +101,13 @@ enum ip_conntrack_events {
 
 enum ip_conntrack_expect_events {
        IPEXP_NEW,              /* new expectation */
+       IPEXP_DESTROY,          /* destroyed expectation */
 };
 
+/* expectation flags */
+#define NF_CT_EXPECT_PERMANENT         0x1
+#define NF_CT_EXPECT_INACTIVE          0x2
+#define NF_CT_EXPECT_USERSPACE         0x4
+
+
 #endif /* _NF_CONNTRACK_COMMON_H */
index 8e145f0d61cb1c7aed4c7f23476086c16f9b99af..2ea22b018a874ae3b6356ebeb63cfc20f45ddbe3 100644 (file)
@@ -1,8 +1,7 @@
 #ifndef _NF_CONNTRACK_TUPLE_COMMON_H
 #define _NF_CONNTRACK_TUPLE_COMMON_H
 
-enum ip_conntrack_dir
-{
+enum ip_conntrack_dir {
        IP_CT_DIR_ORIGINAL,
        IP_CT_DIR_REPLY,
        IP_CT_DIR_MAX
index fa2d9578d7d2ef4b19079464d2d2087e6a4baab5..4120970072771786b50469e5b40d5f65bda9883c 100644 (file)
@@ -66,6 +66,11 @@ struct xt_standard_target {
        int verdict;
 };
 
+struct xt_error_target {
+       struct xt_entry_target target;
+       char errorname[XT_FUNCTION_MAXNAMELEN];
+};
+
 /* The argument to IPT_SO_GET_REVISION_*.  Returns highest revision
  * kernel supports, if >= revision. */
 struct xt_get_revision {
index fbf4c56585547a20839aaaf334e2eb25726f7650..b56e76811c04380e9779dbe82c2cfa4a5b0c6abd 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _XT_CT_H
 #define _XT_CT_H
 
+#include <linux/types.h>
+
 #define XT_CT_NOTRACK  0x1
 
 struct xt_ct_target_info {
index 342ef14b1761017c52072f83c4ad1ef134f3b4a0..7157318499c27b3c96b0e07ae19413fcbe94a827 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _XT_TCPOPTSTRIP_H
 #define _XT_TCPOPTSTRIP_H
 
+#include <linux/types.h>
+
 #define tcpoptstrip_set_bit(bmap, idx) \
        (bmap[(idx) >> 5] |= 1U << (idx & 31))
 #define tcpoptstrip_test_bit(bmap, idx) \
index 8097e0b4c15e78f42e75df6dcae2ed1b9e9eed2e..902043c2073ff7e9d5e195e16246438410f79b1e 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _XT_TPROXY_H
 #define _XT_TPROXY_H
 
+#include <linux/types.h>
+
 /* TPROXY target is capable of marking the packet to perform
  * redirection. We can get rid of that whenever we get support for
  * mutliple targets in the same rule. */
index 66cfa3c782ac5963b4d857c0dc00bfe420b2370e..9b883c8fbf548bb34ab0e97ff48944d85a93d012 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _XT_CLUSTER_MATCH_H
 #define _XT_CLUSTER_MATCH_H
 
+#include <linux/types.h>
+
 enum xt_cluster_flags {
        XT_CLUSTER_F_INV        = (1 << 0)
 };
index 92fcbb0d193eaca99c62c4362f0bf6b1c2217efb..f1d6c15bd9e37edce2efa073424dee386984367e 100644 (file)
@@ -17,8 +17,8 @@ enum xt_connbytes_direction {
 
 struct xt_connbytes_info {
        struct {
-               aligned_u64 from;       /* count to be matched */
-               aligned_u64 to;         /* count to be matched */
+               __aligned_u64 from;     /* count to be matched */
+               __aligned_u64 to;       /* count to be matched */
        } count;
        __u8 what;              /* ipt_connbytes_what */
        __u8 direction; /* ipt_connbytes_direction */
index ba774d30737475bdbcd0086cc7857fee1f730e9f..f9e8c67c38ba0694419204b6cefe83d0dbabbd1c 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _XT_CONNLIMIT_H
 #define _XT_CONNLIMIT_H
 
+#include <linux/types.h>
+
 struct xt_connlimit_data;
 
 enum {
index 8555e399886d09259fe8d8daa1e688a063983499..7d53660a2aa8954654d987b09c18587ea31185c4 100644 (file)
@@ -3,9 +3,6 @@
 
 #include <linux/types.h>
 
-#ifdef __KERNEL__
-#include <linux/if.h>
-#endif
 
 #define XT_PHYSDEV_OP_IN               0x01
 #define XT_PHYSDEV_OP_OUT              0x02
index be8ead05c3164a7ae258ee1b4b7f4e25dc82d183..d246eac81f8dff40df8d1d66966cf3aaa2407166 100644 (file)
@@ -26,30 +26,19 @@ struct xt_policy_spec {
                        reqid:1;
 };
 
-#ifndef __KERNEL__
 union xt_policy_addr {
        struct in_addr  a4;
        struct in6_addr a6;
 };
-#endif
 
 struct xt_policy_elem {
        union {
-#ifdef __KERNEL__
-               struct {
-                       union nf_inet_addr saddr;
-                       union nf_inet_addr smask;
-                       union nf_inet_addr daddr;
-                       union nf_inet_addr dmask;
-               };
-#else
                struct {
                        union xt_policy_addr saddr;
                        union xt_policy_addr smask;
                        union xt_policy_addr daddr;
                        union xt_policy_addr dmask;
                };
-#endif
        };
        __be32                  spi;
        __u32           reqid;
index 8bda65f0bc92b70a1f8d069b3452f8a8f6bf85cd..9314723f39ca19bb4f257e60f711ffedaaa52ee1 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _XT_QUOTA_H
 #define _XT_QUOTA_H
 
+#include <linux/types.h>
+
 enum xt_quota_flags {
        XT_QUOTA_INVERT         = 0x1,
 };
@@ -11,7 +13,7 @@ struct xt_quota_priv;
 struct xt_quota_info {
        __u32 flags;
        __u32 pad;
-       aligned_u64 quota;
+       __aligned_u64 quota;
 
        /* Used internally by the kernel */
        struct xt_quota_priv    *master;
index 29287be696a2673a6edea49c71c1774e4f12970c..a501e6196905d082c81a2d546523933d65de7168 100644 (file)
@@ -66,7 +66,7 @@ struct xt_sctp_info {
 
 #define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
        __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
-static inline bool
+static __inline__ bool
 __sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n)
 {
        unsigned int i;
@@ -78,7 +78,7 @@ __sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n)
 
 #define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
        __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
-static inline bool
+static __inline__ bool
 __sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n)
 {
        unsigned int i;
index 4379ce9fcfa112661dbf45c7a944d6205a075e79..e3a9978f259f55425202664754e13c5504ed579e 100644 (file)
@@ -1,62 +1,8 @@
 #ifndef _XT_SET_H
 #define _XT_SET_H
 
-/* The protocol version */
-#define IPSET_PROTOCOL         5
-
-/* The max length of strings including NUL: set and type identifiers */
-#define IPSET_MAXNAMELEN       32
-
-/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
- * and IPSET_INVALID_ID if you want to increase the max number of sets.
- */
-typedef uint16_t ip_set_id_t;
-
-#define IPSET_INVALID_ID       65535
-
-enum ip_set_dim {
-       IPSET_DIM_ZERO = 0,
-       IPSET_DIM_ONE,
-       IPSET_DIM_TWO,
-       IPSET_DIM_THREE,
-       /* Max dimension in elements.
-        * If changed, new revision of iptables match/target is required.
-        */
-       IPSET_DIM_MAX = 6,
-};
-
-/* Option flags for kernel operations */
-enum ip_set_kopt {
-       IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO),
-       IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE),
-       IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO),
-       IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
-};
-
-/* Interface to iptables/ip6tables */
-
-#define SO_IP_SET              83
-
-union ip_set_name_index {
-       char name[IPSET_MAXNAMELEN];
-       ip_set_id_t index;
-};
-
-#define IP_SET_OP_GET_BYNAME   0x00000006      /* Get set index by name */
-struct ip_set_req_get_set {
-       unsigned op;
-       unsigned version;
-       union ip_set_name_index set;
-};
-
-#define IP_SET_OP_GET_BYINDEX  0x00000007      /* Get set name by index */
-/* Uses ip_set_req_get_set */
-
-#define IP_SET_OP_VERSION      0x00000100      /* Ask kernel version */
-struct ip_set_req_version {
-       unsigned op;
-       unsigned version;
-};
+#include <linux/types.h>
+#include <linux/netfilter/ipset/ip_set.h>
 
 /* Revision 0 interface: backward compatible with netfilter/iptables */
 
@@ -70,11 +16,11 @@ struct ip_set_req_version {
 struct xt_set_info_v0 {
        ip_set_id_t index;
        union {
-               u_int32_t flags[IPSET_DIM_MAX + 1];
+               __u32 flags[IPSET_DIM_MAX + 1];
                struct {
-                       u_int32_t __flags[IPSET_DIM_MAX];
-                       u_int8_t dim;
-                       u_int8_t flags;
+                       __u32 __flags[IPSET_DIM_MAX];
+                       __u8 dim;
+                       __u8 flags;
                } compat;
        } u;
 };
@@ -89,12 +35,12 @@ struct xt_set_info_target_v0 {
        struct xt_set_info_v0 del_set;
 };
 
-/* Revision 1 match and target */
+/* Revision 1  match and target */
 
 struct xt_set_info {
        ip_set_id_t index;
-       u_int8_t dim;
-       u_int8_t flags;
+       __u8 dim;
+       __u8 flags;
 };
 
 /* match and target infos */
@@ -109,16 +55,11 @@ struct xt_set_info_target_v1 {
 
 /* Revision 2 target */
 
-enum ipset_cmd_flags {
-       IPSET_FLAG_BIT_EXIST    = 0,
-       IPSET_FLAG_EXIST        = (1 << IPSET_FLAG_BIT_EXIST),
-};
-
 struct xt_set_info_target_v2 {
        struct xt_set_info add_set;
        struct xt_set_info del_set;
-       u_int32_t flags;
-       u_int32_t timeout;
+       __u32 flags;
+       __u32 timeout;
 };
 
 #endif /*_XT_SET_H*/
index 6f475b8ff34be81caa612bf1a947d3ad627290ab..26d7217bd4f1cf1337a7c1d5d5643801d23b4e8a 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _XT_SOCKET_H
 #define _XT_SOCKET_H
 
+#include <linux/types.h>
+
 enum {
        XT_SOCKET_TRANSPARENT = 1 << 0,
 };
index b8bd4568efdb944bfb00c817326bce333a60267a..7c37fac576c440d34c650dbc352bcceded891808 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _XT_TIME_H
 #define _XT_TIME_H 1
 
+#include <linux/types.h>
+
 struct xt_time_info {
        __u32 date_start;
        __u32 date_stop;
index e8c3d8722baef7895f426e5cd7f7e9be60a58059..04d1bfea03c2cbd9ba4a9c2575e44ef1e9766cd1 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _XT_U32_H
 #define _XT_U32_H 1
 
+#include <linux/types.h>
+
 enum xt_u32_ops {
        XT_U32_AND,
        XT_U32_LEFTSH,
index 735f4b1bb61dfd636c3570c6b8075c3dce411c80..57fd82a16b7da973a49c92221960ce10449b038e 100644 (file)
 #define ipt_target xt_target
 #define ipt_table xt_table
 #define ipt_get_revision xt_get_revision
+#define ipt_entry_match xt_entry_match
+#define ipt_entry_target xt_entry_target
+#define ipt_standard_target xt_standard_target
+#define ipt_error_target xt_error_target
+#define ipt_counters xt_counters
+#define IPT_CONTINUE XT_CONTINUE
+#define IPT_RETURN XT_RETURN
+
+/* This group is older than old (iptables < v1.4.0-rc1~89) */
+#include <linux/netfilter/xt_tcpudp.h>
+#define ipt_udp xt_udp
+#define ipt_tcp xt_tcp
+#define IPT_TCP_INV_SRCPT      XT_TCP_INV_SRCPT
+#define IPT_TCP_INV_DSTPT      XT_TCP_INV_DSTPT
+#define IPT_TCP_INV_FLAGS      XT_TCP_INV_FLAGS
+#define IPT_TCP_INV_OPTION     XT_TCP_INV_OPTION
+#define IPT_TCP_INV_MASK       XT_TCP_INV_MASK
+#define IPT_UDP_INV_SRCPT      XT_UDP_INV_SRCPT
+#define IPT_UDP_INV_DSTPT      XT_UDP_INV_DSTPT
+#define IPT_UDP_INV_MASK       XT_UDP_INV_MASK
+
+/* The argument to IPT_SO_ADD_COUNTERS. */
+#define ipt_counters_info xt_counters_info
+/* Standard return verdict, or do jump. */
+#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
+/* Error verdict. */
+#define IPT_ERROR_TARGET XT_ERROR_TARGET
+
+/* fn returns 0 to continue iteration */
+#define IPT_MATCH_ITERATE(e, fn, args...) \
+       XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
+
+/* fn returns 0 to continue iteration */
+#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
+       XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
 
 /* Yes, Virginia, you have to zero the padding. */
 struct ipt_ip {
@@ -46,12 +81,6 @@ struct ipt_ip {
        u_int8_t invflags;
 };
 
-#define ipt_entry_match xt_entry_match
-#define ipt_entry_target xt_entry_target
-#define ipt_standard_target xt_standard_target
-
-#define ipt_counters xt_counters
-
 /* Values for "flag" field in struct ipt_ip (general ip structure). */
 #define IPT_F_FRAG             0x01    /* Set if rule is a fragment rule */
 #define IPT_F_GOTO             0x02    /* Set if jump is a goto */
@@ -110,23 +139,6 @@ struct ipt_entry {
 #define IPT_SO_GET_REVISION_TARGET     (IPT_BASE_CTL + 3)
 #define IPT_SO_GET_MAX                 IPT_SO_GET_REVISION_TARGET
 
-#define IPT_CONTINUE XT_CONTINUE
-#define IPT_RETURN XT_RETURN
-
-#include <linux/netfilter/xt_tcpudp.h>
-#define ipt_udp xt_udp
-#define ipt_tcp xt_tcp
-
-#define IPT_TCP_INV_SRCPT      XT_TCP_INV_SRCPT
-#define IPT_TCP_INV_DSTPT      XT_TCP_INV_DSTPT
-#define IPT_TCP_INV_FLAGS      XT_TCP_INV_FLAGS
-#define IPT_TCP_INV_OPTION     XT_TCP_INV_OPTION
-#define IPT_TCP_INV_MASK       XT_TCP_INV_MASK
-
-#define IPT_UDP_INV_SRCPT      XT_UDP_INV_SRCPT
-#define IPT_UDP_INV_DSTPT      XT_UDP_INV_DSTPT
-#define IPT_UDP_INV_MASK       XT_UDP_INV_MASK
-
 /* ICMP matching stuff */
 struct ipt_icmp {
        u_int8_t type;                          /* type to match */
@@ -140,7 +152,7 @@ struct ipt_icmp {
 /* The argument to IPT_SO_GET_INFO */
 struct ipt_getinfo {
        /* Which table: caller fills this in. */
-       char name[IPT_TABLE_MAXNAMELEN];
+       char name[XT_TABLE_MAXNAMELEN];
 
        /* Kernel fills these in. */
        /* Which hook entry points are valid: bitmask */
@@ -162,7 +174,7 @@ struct ipt_getinfo {
 /* The argument to IPT_SO_SET_REPLACE. */
 struct ipt_replace {
        /* Which table. */
-       char name[IPT_TABLE_MAXNAMELEN];
+       char name[XT_TABLE_MAXNAMELEN];
 
        /* Which hook entry points are valid: bitmask.  You can't
            change this. */
@@ -190,13 +202,10 @@ struct ipt_replace {
        struct ipt_entry entries[0];
 };
 
-/* The argument to IPT_SO_ADD_COUNTERS. */
-#define ipt_counters_info xt_counters_info
-
 /* The argument to IPT_SO_GET_ENTRIES. */
 struct ipt_get_entries {
        /* Which table: user fills this in. */
-       char name[IPT_TABLE_MAXNAMELEN];
+       char name[XT_TABLE_MAXNAMELEN];
 
        /* User fills this in: total entry size. */
        unsigned int size;
@@ -205,26 +214,13 @@ struct ipt_get_entries {
        struct ipt_entry entrytable[0];
 };
 
-/* Standard return verdict, or do jump. */
-#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
-/* Error verdict. */
-#define IPT_ERROR_TARGET XT_ERROR_TARGET
-
 /* Helper functions */
-static __inline__ struct ipt_entry_target *
+static __inline__ struct xt_entry_target *
 ipt_get_target(struct ipt_entry *e)
 {
        return (void *)e + e->target_offset;
 }
 
-/* fn returns 0 to continue iteration */
-#define IPT_MATCH_ITERATE(e, fn, args...) \
-       XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
-
-/* fn returns 0 to continue iteration */
-#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
-       XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
-
 /*
  *     Main firewall chains definitions and global var's definitions.
  */
index e5a3687c8a7238d90c6be77941429d0ca6071db0..c6a204c97047a671bed64f03230064ef9e174175 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _IPT_CLUSTERIP_H_target
 #define _IPT_CLUSTERIP_H_target
 
+#include <linux/types.h>
+
 enum clusterip_hashmode {
     CLUSTERIP_HASHMODE_SIP = 0,
     CLUSTERIP_HASHMODE_SIP_SPT,
@@ -17,15 +19,15 @@ struct clusterip_config;
 
 struct ipt_clusterip_tgt_info {
 
-       u_int32_t flags;
+       __u32 flags;
 
        /* only relevant for new ones */
-       u_int8_t clustermac[6];
-       u_int16_t num_total_nodes;
-       u_int16_t num_local_nodes;
-       u_int16_t local_nodes[CLUSTERIP_MAX_NODES];
-       u_int32_t hash_mode;
-       u_int32_t hash_initval;
+       __u8 clustermac[6];
+       __u16 num_total_nodes;
+       __u16 num_local_nodes;
+       __u16 local_nodes[CLUSTERIP_MAX_NODES];
+       __u32 hash_mode;
+       __u32 hash_initval;
 
        /* Used internally by the kernel */
        struct clusterip_config *config;
index 7ca45918ab8e5bf86dc349c6bbd2365e679486ad..bb88d5315a4dd7bdd793b2b165a153143fcb19b3 100644 (file)
@@ -8,6 +8,8 @@
 */
 #ifndef _IPT_ECN_TARGET_H
 #define _IPT_ECN_TARGET_H
+
+#include <linux/types.h>
 #include <linux/netfilter/xt_DSCP.h>
 
 #define IPT_ECN_IP_MASK        (~XT_DSCP_MASK)
 #define IPT_ECN_OP_MASK                0xce
 
 struct ipt_ECN_info {
-       u_int8_t operation;     /* bitset of operations */
-       u_int8_t ip_ect;        /* ECT codepoint of IPv4 header, pre-shifted */
+       __u8 operation; /* bitset of operations */
+       __u8 ip_ect;    /* ECT codepoint of IPv4 header, pre-shifted */
        union {
                struct {
-                       u_int8_t ece:1, cwr:1; /* TCP ECT bits */
+                       __u8 ece:1, cwr:1; /* TCP ECT bits */
                } tcp;
        } proto;
 };
index 2529660c5b38e338aa454bcdb3d4a9a2fbc6a513..5bca78267afddf0275a59368ec7db35d31b6c6b6 100644 (file)
@@ -1,15 +1,17 @@
 #ifndef _IPT_SAME_H
 #define _IPT_SAME_H
 
+#include <linux/types.h>
+
 #define IPT_SAME_MAX_RANGE     10
 
 #define IPT_SAME_NODST         0x01
 
 struct ipt_same_info {
        unsigned char info;
-       u_int32_t rangesize;
-       u_int32_t ipnum;
-       u_int32_t *iparray;
+       __u32 rangesize;
+       __u32 ipnum;
+       __u32 *iparray;
 
        /* hangs off end. */
        struct nf_nat_range range[IPT_SAME_MAX_RANGE];
index ee6611edc112e19dcc02bc46d80be0eae97fbc45..f6ac169d92f9bbc6751a930ef0ed64d752dd4542 100644 (file)
@@ -4,6 +4,8 @@
 #ifndef _IPT_TTL_H
 #define _IPT_TTL_H
 
+#include <linux/types.h>
+
 enum {
        IPT_TTL_SET = 0,
        IPT_TTL_INC,
@@ -13,8 +15,8 @@ enum {
 #define IPT_TTL_MAXMODE        IPT_TTL_DEC
 
 struct ipt_TTL_info {
-       u_int8_t        mode;
-       u_int8_t        ttl;
+       __u8    mode;
+       __u8    ttl;
 };
 
 
index 446de6aef9838f07775ae5d28008b1d6ca379ca7..0da42237c8da971d2c94b0c0fc39b4a415e6f8be 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _IPT_ADDRTYPE_H
 #define _IPT_ADDRTYPE_H
 
+#include <linux/types.h>
+
 enum {
        IPT_ADDRTYPE_INVERT_SOURCE      = 0x0001,
        IPT_ADDRTYPE_INVERT_DEST        = 0x0002,
@@ -9,17 +11,17 @@ enum {
 };
 
 struct ipt_addrtype_info_v1 {
-       u_int16_t       source;         /* source-type mask */
-       u_int16_t       dest;           /* dest-type mask */
-       u_int32_t       flags;
+       __u16   source;         /* source-type mask */
+       __u16   dest;           /* dest-type mask */
+       __u32   flags;
 };
 
 /* revision 0 */
 struct ipt_addrtype_info {
-       u_int16_t       source;         /* source-type mask */
-       u_int16_t       dest;           /* dest-type mask */
-       u_int32_t       invert_source;
-       u_int32_t       invert_dest;
+       __u16   source;         /* source-type mask */
+       __u16   dest;           /* dest-type mask */
+       __u32   invert_source;
+       __u32   invert_dest;
 };
 
 #endif
index 2e555b4d05e324f99d793ec627d3cd3aa3ad0be7..4e02bb0119e3c131575118b6f0cf0d868f7de722 100644 (file)
@@ -1,9 +1,11 @@
 #ifndef _IPT_AH_H
 #define _IPT_AH_H
 
+#include <linux/types.h>
+
 struct ipt_ah {
-       u_int32_t spis[2];                      /* Security Parameter Index */
-       u_int8_t  invflags;                     /* Inverse flags */
+       __u32 spis[2];                  /* Security Parameter Index */
+       __u8  invflags;                 /* Inverse flags */
 };
 
 
index 9945baa4ccd7c75eb51190c4e404d9e529d51483..eabf95fb7d3e030c17a2f078ce8621e67d54b38a 100644 (file)
@@ -8,6 +8,8 @@
 */
 #ifndef _IPT_ECN_H
 #define _IPT_ECN_H
+
+#include <linux/types.h>
 #include <linux/netfilter/xt_dscp.h>
 
 #define IPT_ECN_IP_MASK        (~XT_DSCP_MASK)
 
 /* match info */
 struct ipt_ecn_info {
-       u_int8_t operation;
-       u_int8_t invert;
-       u_int8_t ip_ect;
+       __u8 operation;
+       __u8 invert;
+       __u8 ip_ect;
        union {
                struct {
-                       u_int8_t ect;
+                       __u8 ect;
                } tcp;
        } proto;
 };
index ee24fd86a3aaee2c4310921bc860970dd75b3e91..37bee44424860f19e801f1d431b93c9facf3e1cf 100644 (file)
@@ -4,6 +4,8 @@
 #ifndef _IPT_TTL_H
 #define _IPT_TTL_H
 
+#include <linux/types.h>
+
 enum {
        IPT_TTL_EQ = 0,         /* equals */
        IPT_TTL_NE,             /* not equals */
@@ -13,8 +15,8 @@ enum {
 
 
 struct ipt_ttl_info {
-       u_int8_t        mode;
-       u_int8_t        ttl;
+       __u8    mode;
+       __u8    ttl;
 };
 
 
index 6179032327c695c6b86d12ed264b7c43dc0ea19d..3f19a97da02820fcfde3dd481e86bbd73877877f 100644 (file)
 
 #define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
 #define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
-
 #define ip6t_match xt_match
 #define ip6t_target xt_target
 #define ip6t_table xt_table
 #define ip6t_get_revision xt_get_revision
+#define ip6t_entry_match xt_entry_match
+#define ip6t_entry_target xt_entry_target
+#define ip6t_standard_target xt_standard_target
+#define ip6t_error_target xt_error_target
+#define ip6t_counters xt_counters
+#define IP6T_CONTINUE XT_CONTINUE
+#define IP6T_RETURN XT_RETURN
+
+/* Pre-iptables-1.4.0 */
+#include <linux/netfilter/xt_tcpudp.h>
+#define ip6t_tcp xt_tcp
+#define ip6t_udp xt_udp
+#define IP6T_TCP_INV_SRCPT     XT_TCP_INV_SRCPT
+#define IP6T_TCP_INV_DSTPT     XT_TCP_INV_DSTPT
+#define IP6T_TCP_INV_FLAGS     XT_TCP_INV_FLAGS
+#define IP6T_TCP_INV_OPTION    XT_TCP_INV_OPTION
+#define IP6T_TCP_INV_MASK      XT_TCP_INV_MASK
+#define IP6T_UDP_INV_SRCPT     XT_UDP_INV_SRCPT
+#define IP6T_UDP_INV_DSTPT     XT_UDP_INV_DSTPT
+#define IP6T_UDP_INV_MASK      XT_UDP_INV_MASK
+
+#define ip6t_counters_info xt_counters_info
+#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
+#define IP6T_ERROR_TARGET XT_ERROR_TARGET
+#define IP6T_MATCH_ITERATE(e, fn, args...) \
+       XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
+#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
+       XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
 
 /* Yes, Virginia, you have to zero the padding. */
 struct ip6t_ip6 {
@@ -56,12 +83,6 @@ struct ip6t_ip6 {
        u_int8_t invflags;
 };
 
-#define ip6t_entry_match xt_entry_match
-#define ip6t_entry_target xt_entry_target
-#define ip6t_standard_target xt_standard_target
-
-#define ip6t_counters  xt_counters
-
 /* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
 #define IP6T_F_PROTO           0x01    /* Set if rule cares about upper 
                                           protocols */
@@ -106,17 +127,12 @@ struct ip6t_entry {
 /* Standard entry */
 struct ip6t_standard {
        struct ip6t_entry entry;
-       struct ip6t_standard_target target;
-};
-
-struct ip6t_error_target {
-       struct ip6t_entry_target target;
-       char errorname[IP6T_FUNCTION_MAXNAMELEN];
+       struct xt_standard_target target;
 };
 
 struct ip6t_error {
        struct ip6t_entry entry;
-       struct ip6t_error_target target;
+       struct xt_error_target target;
 };
 
 #define IP6T_ENTRY_INIT(__size)                                                       \
@@ -128,16 +144,16 @@ struct ip6t_error {
 #define IP6T_STANDARD_INIT(__verdict)                                         \
 {                                                                             \
        .entry          = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)),       \
-       .target         = XT_TARGET_INIT(IP6T_STANDARD_TARGET,                 \
-                                        sizeof(struct ip6t_standard_target)), \
+       .target         = XT_TARGET_INIT(XT_STANDARD_TARGET,                   \
+                                        sizeof(struct xt_standard_target)),   \
        .target.verdict = -(__verdict) - 1,                                    \
 }
 
 #define IP6T_ERROR_INIT                                                               \
 {                                                                             \
        .entry          = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)),          \
-       .target         = XT_TARGET_INIT(IP6T_ERROR_TARGET,                    \
-                                        sizeof(struct ip6t_error_target)),    \
+       .target         = XT_TARGET_INIT(XT_ERROR_TARGET,                      \
+                                        sizeof(struct xt_error_target)),      \
        .target.errorname = "ERROR",                                           \
 }
 
@@ -160,30 +176,6 @@ struct ip6t_error {
 #define IP6T_SO_GET_REVISION_TARGET    (IP6T_BASE_CTL + 5)
 #define IP6T_SO_GET_MAX                        IP6T_SO_GET_REVISION_TARGET
 
-/* CONTINUE verdict for targets */
-#define IP6T_CONTINUE XT_CONTINUE
-
-/* For standard target */
-#define IP6T_RETURN XT_RETURN
-
-/* TCP/UDP matching stuff */
-#include <linux/netfilter/xt_tcpudp.h>
-
-#define ip6t_tcp xt_tcp
-#define ip6t_udp xt_udp
-
-/* Values for "inv" field in struct ipt_tcp. */
-#define IP6T_TCP_INV_SRCPT     XT_TCP_INV_SRCPT
-#define IP6T_TCP_INV_DSTPT     XT_TCP_INV_DSTPT
-#define IP6T_TCP_INV_FLAGS     XT_TCP_INV_FLAGS
-#define IP6T_TCP_INV_OPTION    XT_TCP_INV_OPTION
-#define IP6T_TCP_INV_MASK      XT_TCP_INV_MASK
-
-/* Values for "invflags" field in struct ipt_udp. */
-#define IP6T_UDP_INV_SRCPT     XT_UDP_INV_SRCPT
-#define IP6T_UDP_INV_DSTPT     XT_UDP_INV_DSTPT
-#define IP6T_UDP_INV_MASK      XT_UDP_INV_MASK
-
 /* ICMP matching stuff */
 struct ip6t_icmp {
        u_int8_t type;                          /* type to match */
@@ -197,7 +189,7 @@ struct ip6t_icmp {
 /* The argument to IP6T_SO_GET_INFO */
 struct ip6t_getinfo {
        /* Which table: caller fills this in. */
-       char name[IP6T_TABLE_MAXNAMELEN];
+       char name[XT_TABLE_MAXNAMELEN];
 
        /* Kernel fills these in. */
        /* Which hook entry points are valid: bitmask */
@@ -219,7 +211,7 @@ struct ip6t_getinfo {
 /* The argument to IP6T_SO_SET_REPLACE. */
 struct ip6t_replace {
        /* Which table. */
-       char name[IP6T_TABLE_MAXNAMELEN];
+       char name[XT_TABLE_MAXNAMELEN];
 
        /* Which hook entry points are valid: bitmask.  You can't
            change this. */
@@ -247,13 +239,10 @@ struct ip6t_replace {
        struct ip6t_entry entries[0];
 };
 
-/* The argument to IP6T_SO_ADD_COUNTERS. */
-#define ip6t_counters_info xt_counters_info
-
 /* The argument to IP6T_SO_GET_ENTRIES. */
 struct ip6t_get_entries {
        /* Which table: user fills this in. */
-       char name[IP6T_TABLE_MAXNAMELEN];
+       char name[XT_TABLE_MAXNAMELEN];
 
        /* User fills this in: total entry size. */
        unsigned int size;
@@ -262,26 +251,13 @@ struct ip6t_get_entries {
        struct ip6t_entry entrytable[0];
 };
 
-/* Standard return verdict, or do jump. */
-#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
-/* Error verdict. */
-#define IP6T_ERROR_TARGET XT_ERROR_TARGET
-
 /* Helper functions */
-static __inline__ struct ip6t_entry_target *
+static __inline__ struct xt_entry_target *
 ip6t_get_target(struct ip6t_entry *e)
 {
        return (void *)e + e->target_offset;
 }
 
-/* fn returns 0 to continue iteration */
-#define IP6T_MATCH_ITERATE(e, fn, args...) \
-       XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
-
-/* fn returns 0 to continue iteration */
-#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
-       XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
-
 /*
  *     Main firewall chains definitions and global var's definitions.
  */
index afb7813d45ab29b37903ded57d221d39ac42b366..ebd8ead1bb63e52a81fc73eb847fbb9cf5861273 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef _IP6T_HL_H
 #define _IP6T_HL_H
 
+#include <linux/types.h>
+
 enum {
        IP6T_HL_SET = 0,
        IP6T_HL_INC,
@@ -14,8 +16,8 @@ enum {
 #define IP6T_HL_MAXMODE        IP6T_HL_DEC
 
 struct ip6t_HL_info {
-       u_int8_t        mode;
-       u_int8_t        hop_limit;
+       __u8    mode;
+       __u8    hop_limit;
 };
 
 
index 6be6504162bbb05dfcbf641e6073731eb2fae781..205ed62e4605dbf3d1ce080ec721b919829af50f 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _IP6T_REJECT_H
 #define _IP6T_REJECT_H
 
+#include <linux/types.h>
+
 enum ip6t_reject_with {
        IP6T_ICMP6_NO_ROUTE,
        IP6T_ICMP6_ADM_PROHIBITED,
@@ -12,7 +14,7 @@ enum ip6t_reject_with {
 };
 
 struct ip6t_reject_info {
-       u_int32_t       with;   /* reject type */
+       __u32   with;   /* reject type */
 };
 
 #endif /*_IP6T_REJECT_H*/
index 17a745cfb2c778cfff11b2601c2ce0bacf184f24..5da2b65cb3ade90c6ab2c515b86277812ec20a66 100644 (file)
@@ -1,11 +1,13 @@
 #ifndef _IP6T_AH_H
 #define _IP6T_AH_H
 
+#include <linux/types.h>
+
 struct ip6t_ah {
-       u_int32_t spis[2];                      /* Security Parameter Index */
-       u_int32_t hdrlen;                       /* Header Length */
-       u_int8_t  hdrres;                       /* Test of the Reserved Filed */
-       u_int8_t  invflags;                     /* Inverse flags */
+       __u32 spis[2];                  /* Security Parameter Index */
+       __u32 hdrlen;                   /* Header Length */
+       __u8  hdrres;                   /* Test of the Reserved Filed */
+       __u8  invflags;                 /* Inverse flags */
 };
 
 #define IP6T_AH_SPI 0x01
index 3724d08509200bab13421b3ed61c61ccbef48825..b47f61b9e082f1281023076577fa2e182aa2b616 100644 (file)
@@ -1,11 +1,13 @@
 #ifndef _IP6T_FRAG_H
 #define _IP6T_FRAG_H
 
+#include <linux/types.h>
+
 struct ip6t_frag {
-       u_int32_t ids[2];                       /* Security Parameter Index */
-       u_int32_t hdrlen;                       /* Header Length */
-       u_int8_t  flags;                        /*  */
-       u_int8_t  invflags;                     /* Inverse flags */
+       __u32 ids[2];                   /* Security Parameter Index */
+       __u32 hdrlen;                   /* Header Length */
+       __u8  flags;                    /*  */
+       __u8  invflags;                 /* Inverse flags */
 };
 
 #define IP6T_FRAG_IDS          0x01
index 5ef91b8319a8afd7bb320d15d8d90f3e6e7353a9..6e76dbc6c19aa0c7f0d15205535501f0035acdcb 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef _IP6T_HL_H
 #define _IP6T_HL_H
 
+#include <linux/types.h>
+
 enum {
        IP6T_HL_EQ = 0,         /* equals */
        IP6T_HL_NE,             /* not equals */
@@ -14,8 +16,8 @@ enum {
 
 
 struct ip6t_hl_info {
-       u_int8_t        mode;
-       u_int8_t        hop_limit;
+       __u8    mode;
+       __u8    hop_limit;
 };
 
 
index 01dfd445596a3bf01810b0f61568653acda76ac2..efae3a20c2141f9212dcfb37539efdb0f090e599 100644 (file)
@@ -8,10 +8,12 @@ on whether they contain certain headers */
 #ifndef __IPV6HEADER_H
 #define __IPV6HEADER_H
 
+#include <linux/types.h>
+
 struct ip6t_ipv6header_info {
-       u_int8_t matchflags;
-       u_int8_t invflags;
-       u_int8_t modeflag;
+       __u8 matchflags;
+       __u8 invflags;
+       __u8 modeflag;
 };
 
 #define MASK_HOPOPTS    128
index 18549bca2d1f5609785ee33a42972ad288af66e9..a7729a5025cd08a7fee0da40169e5d1d451b1f34 100644 (file)
@@ -1,10 +1,12 @@
 #ifndef _IP6T_MH_H
 #define _IP6T_MH_H
 
+#include <linux/types.h>
+
 /* MH matching stuff */
 struct ip6t_mh {
-       u_int8_t types[2];      /* MH type range */
-       u_int8_t invflags;      /* Inverse flags */
+       __u8 types[2];  /* MH type range */
+       __u8 invflags;  /* Inverse flags */
 };
 
 /* Values for "invflags" field in struct ip6t_mh. */
index 62d89bcd9f9cff3be87ad029cf3e5ba2495a79a1..17d419a811fdfef99678bf12d9bc060fccb7192b 100644 (file)
@@ -1,14 +1,16 @@
 #ifndef _IP6T_OPTS_H
 #define _IP6T_OPTS_H
 
+#include <linux/types.h>
+
 #define IP6T_OPTS_OPTSNR 16
 
 struct ip6t_opts {
-       u_int32_t hdrlen;                       /* Header Length */
-       u_int8_t flags;                         /*  */
-       u_int8_t invflags;                      /* Inverse flags */
-       u_int16_t opts[IP6T_OPTS_OPTSNR];       /* opts */
-       u_int8_t optsnr;                        /* Nr of OPts */
+       __u32 hdrlen;                   /* Header Length */
+       __u8 flags;                             /*  */
+       __u8 invflags;                  /* Inverse flags */
+       __u16 opts[IP6T_OPTS_OPTSNR];   /* opts */
+       __u8 optsnr;                    /* Nr of OPts */
 };
 
 #define IP6T_OPTS_LEN          0x01
index ab91bfd2cd00f7dcc931f53f395feaaa2a793660..7605a5ff81cd6560c10b60daf91ab889e4843b9d 100644 (file)
@@ -1,18 +1,19 @@
 #ifndef _IP6T_RT_H
 #define _IP6T_RT_H
 
+#include <linux/types.h>
 /*#include <linux/in6.h>*/
 
 #define IP6T_RT_HOPS 16
 
 struct ip6t_rt {
-       u_int32_t rt_type;                      /* Routing Type */
-       u_int32_t segsleft[2];                  /* Segments Left */
-       u_int32_t hdrlen;                       /* Header Length */
-       u_int8_t  flags;                        /*  */
-       u_int8_t  invflags;                     /* Inverse flags */
+       __u32 rt_type;                  /* Routing Type */
+       __u32 segsleft[2];                      /* Segments Left */
+       __u32 hdrlen;                   /* Header Length */
+       __u8  flags;                    /*  */
+       __u8  invflags;                 /* Inverse flags */
        struct in6_addr addrs[IP6T_RT_HOPS];    /* Hops */
-       u_int8_t addrnr;                        /* Nr of Addresses */
+       __u8 addrnr;                    /* Nr of Addresses */
 };
 
 #define IP6T_RT_TYP            0x01
index 8b483c80aeeb2b4c5670a1bea084cffd47d46c37..630cd3bb01f0a2913ca4fc9f006cf126df47a4f0 100644 (file)
@@ -34,5 +34,18 @@ typedef __u64 __bitwise __be64;
 typedef __u16 __bitwise __sum16;
 typedef __u32 __bitwise __wsum;
 
+/*
+ * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
+ * common 32/64-bit compat problems.
+ * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
+ * architectures) and to 8-byte boundaries on 64-bit architetures.  The new
+ * aligned_64 type enforces 8-byte alignment so that structs containing
+ * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
+ * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
+ */
+#define __aligned_u64 __u64 __attribute__((aligned(8)))
+#define __aligned_be64 __be64 __attribute__((aligned(8)))
+#define __aligned_le64 __le64 __attribute__((aligned(8)))
+
 #endif /*  __ASSEMBLY__ */
 #endif /* _LINUX_TYPES_H */