ip_tables.h revision 96c1db7b9d601c31d103389cac074a6cce0d7633
1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ***   To edit the content of this header, modify the corresponding
11 ***   source file (e.g. under external/kernel-headers/original/) then
12 ***   run bionic/libc/kernel/tools/update_all.py
13 ***
14 ***   Any manual change here will be lost the next time this script will
15 ***   be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI_IPTABLES_H
20#define _UAPI_IPTABLES_H
21#include <linux/types.h>
22#include <linux/compiler.h>
23#include <linux/if.h>
24#include <linux/netfilter_ipv4.h>
25#include <linux/netfilter/x_tables.h>
26#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
27#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
28#define ipt_match xt_match
29#define ipt_target xt_target
30#define ipt_table xt_table
31#define ipt_get_revision xt_get_revision
32#define ipt_entry_match xt_entry_match
33#define ipt_entry_target xt_entry_target
34#define ipt_standard_target xt_standard_target
35#define ipt_error_target xt_error_target
36#define ipt_counters xt_counters
37#define IPT_CONTINUE XT_CONTINUE
38#define IPT_RETURN XT_RETURN
39#include <linux/netfilter/xt_tcpudp.h>
40#define ipt_udp xt_udp
41#define ipt_tcp xt_tcp
42#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT
43#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT
44#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS
45#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION
46#define IPT_TCP_INV_MASK XT_TCP_INV_MASK
47#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT
48#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT
49#define IPT_UDP_INV_MASK XT_UDP_INV_MASK
50#define ipt_counters_info xt_counters_info
51#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
52#define IPT_ERROR_TARGET XT_ERROR_TARGET
53#define IPT_MATCH_ITERATE(e,fn,args...) XT_MATCH_ITERATE(struct ipt_entry, e, fn, ##args)
54#define IPT_ENTRY_ITERATE(entries,size,fn,args...) XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ##args)
55struct ipt_ip {
56  struct in_addr src, dst;
57  struct in_addr smsk, dmsk;
58  char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
59  unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
60  __u16 proto;
61  __u8 flags;
62  __u8 invflags;
63};
64#define IPT_F_FRAG 0x01
65#define IPT_F_GOTO 0x02
66#define IPT_F_MASK 0x03
67#define IPT_INV_VIA_IN 0x01
68#define IPT_INV_VIA_OUT 0x02
69#define IPT_INV_TOS 0x04
70#define IPT_INV_SRCIP 0x08
71#define IPT_INV_DSTIP 0x10
72#define IPT_INV_FRAG 0x20
73#define IPT_INV_PROTO XT_INV_PROTO
74#define IPT_INV_MASK 0x7F
75struct ipt_entry {
76  struct ipt_ip ip;
77  unsigned int nfcache;
78  __u16 target_offset;
79  __u16 next_offset;
80  unsigned int comefrom;
81  struct xt_counters counters;
82  unsigned char elems[0];
83};
84#define IPT_BASE_CTL 64
85#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
86#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1)
87#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS
88#define IPT_SO_GET_INFO (IPT_BASE_CTL)
89#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1)
90#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2)
91#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3)
92#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET
93struct ipt_icmp {
94  __u8 type;
95  __u8 code[2];
96  __u8 invflags;
97};
98#define IPT_ICMP_INV 0x01
99struct ipt_getinfo {
100  char name[XT_TABLE_MAXNAMELEN];
101  unsigned int valid_hooks;
102  unsigned int hook_entry[NF_INET_NUMHOOKS];
103  unsigned int underflow[NF_INET_NUMHOOKS];
104  unsigned int num_entries;
105  unsigned int size;
106};
107struct ipt_replace {
108  char name[XT_TABLE_MAXNAMELEN];
109  unsigned int valid_hooks;
110  unsigned int num_entries;
111  unsigned int size;
112  unsigned int hook_entry[NF_INET_NUMHOOKS];
113  unsigned int underflow[NF_INET_NUMHOOKS];
114  unsigned int num_counters;
115  struct xt_counters __user * counters;
116  struct ipt_entry entries[0];
117};
118struct ipt_get_entries {
119  char name[XT_TABLE_MAXNAMELEN];
120  unsigned int size;
121  struct ipt_entry entrytable[0];
122};
123static __inline__ struct xt_entry_target * ipt_get_target(struct ipt_entry * e) {
124  return(void *) e + e->target_offset;
125}
126#endif
127