aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-10-09 04:48:59 -0400
committerDavid Howells <dhowells@redhat.com>2012-10-09 04:48:59 -0400
commit17c075923da59c217155d0758ee0715641ebc152 (patch)
tree25c7c5c9a38e4be68ea7d3d8859bb55474199143 /include/uapi/linux
parent55c5cd3cc179eb87faa9cc2d9741047dd1642aaf (diff)
UAPI: (Scripted) Disintegrate include/linux/netfilter_ipv4
Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Michael Kerrisk <mtk.manpages@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/netfilter_ipv4/Kbuild10
-rw-r--r--include/uapi/linux/netfilter_ipv4/ip_tables.h229
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h36
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ECN.h33
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_LOG.h21
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_REJECT.h20
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_TTL.h23
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ULOG.h49
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ah.h17
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ecn.h15
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ttl.h23
11 files changed, 476 insertions, 0 deletions
diff --git a/include/uapi/linux/netfilter_ipv4/Kbuild b/include/uapi/linux/netfilter_ipv4/Kbuild
index aafaa5aa54d4..fb008437dde1 100644
--- a/include/uapi/linux/netfilter_ipv4/Kbuild
+++ b/include/uapi/linux/netfilter_ipv4/Kbuild
@@ -1 +1,11 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += ip_tables.h
3header-y += ipt_CLUSTERIP.h
4header-y += ipt_ECN.h
5header-y += ipt_LOG.h
6header-y += ipt_REJECT.h
7header-y += ipt_TTL.h
8header-y += ipt_ULOG.h
9header-y += ipt_ah.h
10header-y += ipt_ecn.h
11header-y += ipt_ttl.h
diff --git a/include/uapi/linux/netfilter_ipv4/ip_tables.h b/include/uapi/linux/netfilter_ipv4/ip_tables.h
new file mode 100644
index 000000000000..f1e6ef256034
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h
@@ -0,0 +1,229 @@
1/*
2 * 25-Jul-1998 Major changes to allow for ip chain table
3 *
4 * 3-Jan-2000 Named tables to allow packet selection for different uses.
5 */
6
7/*
8 * Format of an IP firewall descriptor
9 *
10 * src, dst, src_mask, dst_mask are always stored in network byte order.
11 * flags are stored in host byte order (of course).
12 * Port numbers are stored in HOST byte order.
13 */
14
15#ifndef _UAPI_IPTABLES_H
16#define _UAPI_IPTABLES_H
17
18#include <linux/types.h>
19#include <linux/compiler.h>
20#include <linux/netfilter_ipv4.h>
21
22#include <linux/netfilter/x_tables.h>
23
24#ifndef __KERNEL__
25#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
26#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
27#define ipt_match xt_match
28#define ipt_target xt_target
29#define ipt_table xt_table
30#define ipt_get_revision xt_get_revision
31#define ipt_entry_match xt_entry_match
32#define ipt_entry_target xt_entry_target
33#define ipt_standard_target xt_standard_target
34#define ipt_error_target xt_error_target
35#define ipt_counters xt_counters
36#define IPT_CONTINUE XT_CONTINUE
37#define IPT_RETURN XT_RETURN
38
39/* This group is older than old (iptables < v1.4.0-rc1~89) */
40#include <linux/netfilter/xt_tcpudp.h>
41#define ipt_udp xt_udp
42#define ipt_tcp xt_tcp
43#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT
44#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT
45#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS
46#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION
47#define IPT_TCP_INV_MASK XT_TCP_INV_MASK
48#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT
49#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT
50#define IPT_UDP_INV_MASK XT_UDP_INV_MASK
51
52/* The argument to IPT_SO_ADD_COUNTERS. */
53#define ipt_counters_info xt_counters_info
54/* Standard return verdict, or do jump. */
55#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
56/* Error verdict. */
57#define IPT_ERROR_TARGET XT_ERROR_TARGET
58
59/* fn returns 0 to continue iteration */
60#define IPT_MATCH_ITERATE(e, fn, args...) \
61 XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
62
63/* fn returns 0 to continue iteration */
64#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
65 XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
66#endif
67
68/* Yes, Virginia, you have to zero the padding. */
69struct ipt_ip {
70 /* Source and destination IP addr */
71 struct in_addr src, dst;
72 /* Mask for src and dest IP addr */
73 struct in_addr smsk, dmsk;
74 char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
75 unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
76
77 /* Protocol, 0 = ANY */
78 __u16 proto;
79
80 /* Flags word */
81 __u8 flags;
82 /* Inverse flags */
83 __u8 invflags;
84};
85
86/* Values for "flag" field in struct ipt_ip (general ip structure). */
87#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */
88#define IPT_F_GOTO 0x02 /* Set if jump is a goto */
89#define IPT_F_MASK 0x03 /* All possible flag bits mask. */
90
91/* Values for "inv" field in struct ipt_ip. */
92#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */
93#define IPT_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */
94#define IPT_INV_TOS 0x04 /* Invert the sense of TOS. */
95#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
96#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
97#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */
98#define IPT_INV_PROTO XT_INV_PROTO
99#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */
100
101/* This structure defines each of the firewall rules. Consists of 3
102 parts which are 1) general IP header stuff 2) match specific
103 stuff 3) the target to perform if the rule matches */
104struct ipt_entry {
105 struct ipt_ip ip;
106
107 /* Mark with fields that we care about. */
108 unsigned int nfcache;
109
110 /* Size of ipt_entry + matches */
111 __u16 target_offset;
112 /* Size of ipt_entry + matches + target */
113 __u16 next_offset;
114
115 /* Back pointer */
116 unsigned int comefrom;
117
118 /* Packet and byte counters. */
119 struct xt_counters counters;
120
121 /* The matches (if any), then the target. */
122 unsigned char elems[0];
123};
124
125/*
126 * New IP firewall options for [gs]etsockopt at the RAW IP level.
127 * Unlike BSD Linux inherits IP options so you don't have to use a raw
128 * socket for this. Instead we check rights in the calls.
129 *
130 * ATTENTION: check linux/in.h before adding new number here.
131 */
132#define IPT_BASE_CTL 64
133
134#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
135#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1)
136#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS
137
138#define IPT_SO_GET_INFO (IPT_BASE_CTL)
139#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1)
140#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2)
141#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3)
142#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET
143
144/* ICMP matching stuff */
145struct ipt_icmp {
146 __u8 type; /* type to match */
147 __u8 code[2]; /* range of code */
148 __u8 invflags; /* Inverse flags */
149};
150
151/* Values for "inv" field for struct ipt_icmp. */
152#define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */
153
154/* The argument to IPT_SO_GET_INFO */
155struct ipt_getinfo {
156 /* Which table: caller fills this in. */
157 char name[XT_TABLE_MAXNAMELEN];
158
159 /* Kernel fills these in. */
160 /* Which hook entry points are valid: bitmask */
161 unsigned int valid_hooks;
162
163 /* Hook entry points: one per netfilter hook. */
164 unsigned int hook_entry[NF_INET_NUMHOOKS];
165
166 /* Underflow points. */
167 unsigned int underflow[NF_INET_NUMHOOKS];
168
169 /* Number of entries */
170 unsigned int num_entries;
171
172 /* Size of entries. */
173 unsigned int size;
174};
175
176/* The argument to IPT_SO_SET_REPLACE. */
177struct ipt_replace {
178 /* Which table. */
179 char name[XT_TABLE_MAXNAMELEN];
180
181 /* Which hook entry points are valid: bitmask. You can't
182 change this. */
183 unsigned int valid_hooks;
184
185 /* Number of entries */
186 unsigned int num_entries;
187
188 /* Total size of new entries */
189 unsigned int size;
190
191 /* Hook entry points. */
192 unsigned int hook_entry[NF_INET_NUMHOOKS];
193
194 /* Underflow points. */
195 unsigned int underflow[NF_INET_NUMHOOKS];
196
197 /* Information about old entries: */
198 /* Number of counters (must be equal to current number of entries). */
199 unsigned int num_counters;
200 /* The old entries' counters. */
201 struct xt_counters __user *counters;
202
203 /* The entries (hang off end: not really an array). */
204 struct ipt_entry entries[0];
205};
206
207/* The argument to IPT_SO_GET_ENTRIES. */
208struct ipt_get_entries {
209 /* Which table: user fills this in. */
210 char name[XT_TABLE_MAXNAMELEN];
211
212 /* User fills this in: total entry size. */
213 unsigned int size;
214
215 /* The entries. */
216 struct ipt_entry entrytable[0];
217};
218
219/* Helper functions */
220static __inline__ struct xt_entry_target *
221ipt_get_target(struct ipt_entry *e)
222{
223 return (void *)e + e->target_offset;
224}
225
226/*
227 * Main firewall chains definitions and global var's definitions.
228 */
229#endif /* _UAPI_IPTABLES_H */
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h
new file mode 100644
index 000000000000..c6a204c97047
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h
@@ -0,0 +1,36 @@
1#ifndef _IPT_CLUSTERIP_H_target
2#define _IPT_CLUSTERIP_H_target
3
4#include <linux/types.h>
5
6enum clusterip_hashmode {
7 CLUSTERIP_HASHMODE_SIP = 0,
8 CLUSTERIP_HASHMODE_SIP_SPT,
9 CLUSTERIP_HASHMODE_SIP_SPT_DPT,
10};
11
12#define CLUSTERIP_HASHMODE_MAX CLUSTERIP_HASHMODE_SIP_SPT_DPT
13
14#define CLUSTERIP_MAX_NODES 16
15
16#define CLUSTERIP_FLAG_NEW 0x00000001
17
18struct clusterip_config;
19
20struct ipt_clusterip_tgt_info {
21
22 __u32 flags;
23
24 /* only relevant for new ones */
25 __u8 clustermac[6];
26 __u16 num_total_nodes;
27 __u16 num_local_nodes;
28 __u16 local_nodes[CLUSTERIP_MAX_NODES];
29 __u32 hash_mode;
30 __u32 hash_initval;
31
32 /* Used internally by the kernel */
33 struct clusterip_config *config;
34};
35
36#endif /*_IPT_CLUSTERIP_H_target*/
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
new file mode 100644
index 000000000000..bb88d5315a4d
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
@@ -0,0 +1,33 @@
1/* Header file for iptables ipt_ECN target
2 *
3 * (C) 2002 by Harald Welte <laforge@gnumonks.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * ipt_ECN.h,v 1.3 2002/05/29 12:17:40 laforge Exp
8*/
9#ifndef _IPT_ECN_TARGET_H
10#define _IPT_ECN_TARGET_H
11
12#include <linux/types.h>
13#include <linux/netfilter/xt_DSCP.h>
14
15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
16
17#define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */
18#define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */
19#define IPT_ECN_OP_SET_CWR 0x20 /* set CWR bit of TCP header */
20
21#define IPT_ECN_OP_MASK 0xce
22
23struct ipt_ECN_info {
24 __u8 operation; /* bitset of operations */
25 __u8 ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */
26 union {
27 struct {
28 __u8 ece:1, cwr:1; /* TCP ECT bits */
29 } tcp;
30 } proto;
31};
32
33#endif /* _IPT_ECN_TARGET_H */
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_LOG.h b/include/uapi/linux/netfilter_ipv4/ipt_LOG.h
new file mode 100644
index 000000000000..5d8152077d71
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ipt_LOG.h
@@ -0,0 +1,21 @@
1#ifndef _IPT_LOG_H
2#define _IPT_LOG_H
3
4#warning "Please update iptables, this file will be removed soon!"
5
6/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */
7#define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
8#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */
9#define IPT_LOG_IPOPT 0x04 /* Log IP options */
10#define IPT_LOG_UID 0x08 /* Log UID owning local socket */
11#define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */
12#define IPT_LOG_MACDECODE 0x20 /* Decode MAC header */
13#define IPT_LOG_MASK 0x2f
14
15struct ipt_log_info {
16 unsigned char level;
17 unsigned char logflags;
18 char prefix[30];
19};
20
21#endif /*_IPT_LOG_H*/
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_REJECT.h b/include/uapi/linux/netfilter_ipv4/ipt_REJECT.h
new file mode 100644
index 000000000000..4293a1ad1b01
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ipt_REJECT.h
@@ -0,0 +1,20 @@
1#ifndef _IPT_REJECT_H
2#define _IPT_REJECT_H
3
4enum ipt_reject_with {
5 IPT_ICMP_NET_UNREACHABLE,
6 IPT_ICMP_HOST_UNREACHABLE,
7 IPT_ICMP_PROT_UNREACHABLE,
8 IPT_ICMP_PORT_UNREACHABLE,
9 IPT_ICMP_ECHOREPLY,
10 IPT_ICMP_NET_PROHIBITED,
11 IPT_ICMP_HOST_PROHIBITED,
12 IPT_TCP_RESET,
13 IPT_ICMP_ADMIN_PROHIBITED
14};
15
16struct ipt_reject_info {
17 enum ipt_reject_with with; /* reject type */
18};
19
20#endif /*_IPT_REJECT_H*/
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_TTL.h b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
new file mode 100644
index 000000000000..f6ac169d92f9
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
@@ -0,0 +1,23 @@
1/* TTL modification module for IP tables
2 * (C) 2000 by Harald Welte <laforge@netfilter.org> */
3
4#ifndef _IPT_TTL_H
5#define _IPT_TTL_H
6
7#include <linux/types.h>
8
9enum {
10 IPT_TTL_SET = 0,
11 IPT_TTL_INC,
12 IPT_TTL_DEC
13};
14
15#define IPT_TTL_MAXMODE IPT_TTL_DEC
16
17struct ipt_TTL_info {
18 __u8 mode;
19 __u8 ttl;
20};
21
22
23#endif
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ULOG.h b/include/uapi/linux/netfilter_ipv4/ipt_ULOG.h
new file mode 100644
index 000000000000..417aad280bcc
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ULOG.h
@@ -0,0 +1,49 @@
1/* Header file for IP tables userspace logging, Version 1.8
2 *
3 * (C) 2000-2002 by Harald Welte <laforge@gnumonks.org>
4 *
5 * Distributed under the terms of GNU GPL */
6
7#ifndef _IPT_ULOG_H
8#define _IPT_ULOG_H
9
10#ifndef NETLINK_NFLOG
11#define NETLINK_NFLOG 5
12#endif
13
14#define ULOG_DEFAULT_NLGROUP 1
15#define ULOG_DEFAULT_QTHRESHOLD 1
16
17#define ULOG_MAC_LEN 80
18#define ULOG_PREFIX_LEN 32
19
20#define ULOG_MAX_QLEN 50
21/* Why 50? Well... there is a limit imposed by the slab cache 131000
22 * bytes. So the multipart netlink-message has to be < 131000 bytes.
23 * Assuming a standard ethernet-mtu of 1500, we could define this up
24 * to 80... but even 50 seems to be big enough. */
25
26/* private data structure for each rule with a ULOG target */
27struct ipt_ulog_info {
28 unsigned int nl_group;
29 size_t copy_range;
30 size_t qthreshold;
31 char prefix[ULOG_PREFIX_LEN];
32};
33
34/* Format of the ULOG packets passed through netlink */
35typedef struct ulog_packet_msg {
36 unsigned long mark;
37 long timestamp_sec;
38 long timestamp_usec;
39 unsigned int hook;
40 char indev_name[IFNAMSIZ];
41 char outdev_name[IFNAMSIZ];
42 size_t data_len;
43 char prefix[ULOG_PREFIX_LEN];
44 unsigned char mac_len;
45 unsigned char mac[ULOG_MAC_LEN];
46 unsigned char payload[0];
47} ulog_packet_msg_t;
48
49#endif /*_IPT_ULOG_H*/
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ah.h b/include/uapi/linux/netfilter_ipv4/ipt_ah.h
new file mode 100644
index 000000000000..4e02bb0119e3
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ah.h
@@ -0,0 +1,17 @@
1#ifndef _IPT_AH_H
2#define _IPT_AH_H
3
4#include <linux/types.h>
5
6struct ipt_ah {
7 __u32 spis[2]; /* Security Parameter Index */
8 __u8 invflags; /* Inverse flags */
9};
10
11
12
13/* Values for "invflags" field in struct ipt_ah. */
14#define IPT_AH_INV_SPI 0x01 /* Invert the sense of spi. */
15#define IPT_AH_INV_MASK 0x01 /* All possible flags. */
16
17#endif /*_IPT_AH_H*/
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ecn.h b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
new file mode 100644
index 000000000000..0e0c063dbf60
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
@@ -0,0 +1,15 @@
1#ifndef _IPT_ECN_H
2#define _IPT_ECN_H
3
4#include <linux/netfilter/xt_ecn.h>
5#define ipt_ecn_info xt_ecn_info
6
7enum {
8 IPT_ECN_IP_MASK = XT_ECN_IP_MASK,
9 IPT_ECN_OP_MATCH_IP = XT_ECN_OP_MATCH_IP,
10 IPT_ECN_OP_MATCH_ECE = XT_ECN_OP_MATCH_ECE,
11 IPT_ECN_OP_MATCH_CWR = XT_ECN_OP_MATCH_CWR,
12 IPT_ECN_OP_MATCH_MASK = XT_ECN_OP_MATCH_MASK,
13};
14
15#endif /* IPT_ECN_H */
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ttl.h b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
new file mode 100644
index 000000000000..37bee4442486
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
@@ -0,0 +1,23 @@
1/* IP tables module for matching the value of the TTL
2 * (C) 2000 by Harald Welte <laforge@gnumonks.org> */
3
4#ifndef _IPT_TTL_H
5#define _IPT_TTL_H
6
7#include <linux/types.h>
8
9enum {
10 IPT_TTL_EQ = 0, /* equals */
11 IPT_TTL_NE, /* not equals */
12 IPT_TTL_LT, /* less than */
13 IPT_TTL_GT, /* greater than */
14};
15
16
17struct ipt_ttl_info {
18 __u8 mode;
19 __u8 ttl;
20};
21
22
23#endif