ebtables.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__LINUX_BRIDGE_EFF_H
20#define _UAPI__LINUX_BRIDGE_EFF_H
21#include <linux/types.h>
22#include <linux/if.h>
23#include <linux/netfilter_bridge.h>
24#define EBT_TABLE_MAXNAMELEN 32
25#define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN
26#define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN
27#define EBT_ACCEPT - 1
28#define EBT_DROP - 2
29#define EBT_CONTINUE - 3
30#define EBT_RETURN - 4
31#define NUM_STANDARD_TARGETS 4
32#define EBT_VERDICT_BITS 0x0000000F
33struct xt_match;
34struct xt_target;
35struct ebt_counter {
36  __u64 pcnt;
37  __u64 bcnt;
38};
39struct ebt_replace {
40  char name[EBT_TABLE_MAXNAMELEN];
41  unsigned int valid_hooks;
42  unsigned int nentries;
43  unsigned int entries_size;
44  struct ebt_entries __user * hook_entry[NF_BR_NUMHOOKS];
45  unsigned int num_counters;
46  struct ebt_counter __user * counters;
47  char __user * entries;
48};
49struct ebt_replace_kernel {
50  char name[EBT_TABLE_MAXNAMELEN];
51  unsigned int valid_hooks;
52  unsigned int nentries;
53  unsigned int entries_size;
54  struct ebt_entries * hook_entry[NF_BR_NUMHOOKS];
55  unsigned int num_counters;
56  struct ebt_counter * counters;
57  char * entries;
58};
59struct ebt_entries {
60  unsigned int distinguisher;
61  char name[EBT_CHAIN_MAXNAMELEN];
62  unsigned int counter_offset;
63  int policy;
64  unsigned int nentries;
65  char data[0] __attribute__((aligned(__alignof__(struct ebt_replace))));
66};
67#define EBT_ENTRY_OR_ENTRIES 0x01
68#define EBT_NOPROTO 0x02
69#define EBT_802_3 0x04
70#define EBT_SOURCEMAC 0x08
71#define EBT_DESTMAC 0x10
72#define EBT_F_MASK (EBT_NOPROTO | EBT_802_3 | EBT_SOURCEMAC | EBT_DESTMAC | EBT_ENTRY_OR_ENTRIES)
73#define EBT_IPROTO 0x01
74#define EBT_IIN 0x02
75#define EBT_IOUT 0x04
76#define EBT_ISOURCE 0x8
77#define EBT_IDEST 0x10
78#define EBT_ILOGICALIN 0x20
79#define EBT_ILOGICALOUT 0x40
80#define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST)
81struct ebt_entry_match {
82  union {
83    char name[EBT_FUNCTION_MAXNAMELEN];
84    struct xt_match * match;
85  } u;
86  unsigned int match_size;
87  unsigned char data[0] __attribute__((aligned(__alignof__(struct ebt_replace))));
88};
89struct ebt_entry_watcher {
90  union {
91    char name[EBT_FUNCTION_MAXNAMELEN];
92    struct xt_target * watcher;
93  } u;
94  unsigned int watcher_size;
95  unsigned char data[0] __attribute__((aligned(__alignof__(struct ebt_replace))));
96};
97struct ebt_entry_target {
98  union {
99    char name[EBT_FUNCTION_MAXNAMELEN];
100    struct xt_target * target;
101  } u;
102  unsigned int target_size;
103  unsigned char data[0] __attribute__((aligned(__alignof__(struct ebt_replace))));
104};
105#define EBT_STANDARD_TARGET "standard"
106struct ebt_standard_target {
107  struct ebt_entry_target target;
108  int verdict;
109};
110struct ebt_entry {
111  unsigned int bitmask;
112  unsigned int invflags;
113  __be16 ethproto;
114  char in[IFNAMSIZ];
115  char logical_in[IFNAMSIZ];
116  char out[IFNAMSIZ];
117  char logical_out[IFNAMSIZ];
118  unsigned char sourcemac[ETH_ALEN];
119  unsigned char sourcemsk[ETH_ALEN];
120  unsigned char destmac[ETH_ALEN];
121  unsigned char destmsk[ETH_ALEN];
122  unsigned int watchers_offset;
123  unsigned int target_offset;
124  unsigned int next_offset;
125  unsigned char elems[0] __attribute__((aligned(__alignof__(struct ebt_replace))));
126};
127#define EBT_BASE_CTL 128
128#define EBT_SO_SET_ENTRIES (EBT_BASE_CTL)
129#define EBT_SO_SET_COUNTERS (EBT_SO_SET_ENTRIES + 1)
130#define EBT_SO_SET_MAX (EBT_SO_SET_COUNTERS + 1)
131#define EBT_SO_GET_INFO (EBT_BASE_CTL)
132#define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO + 1)
133#define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES + 1)
134#define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO + 1)
135#define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES + 1)
136#define EBT_MATCH_ITERATE(e,fn,args...) \
137({ unsigned int __i; int __ret = 0; struct ebt_entry_match * __match; for(__i = sizeof(struct ebt_entry); __i < (e)->watchers_offset; __i += __match->match_size + sizeof(struct ebt_entry_match)) { __match = (void *) (e) + __i; __ret = fn(__match, ##args); if(__ret != 0) break; } if(__ret == 0) { if(__i != (e)->watchers_offset) __ret = - EINVAL; } __ret; \
138})
139#define EBT_WATCHER_ITERATE(e,fn,args...) \
140({ unsigned int __i; int __ret = 0; struct ebt_entry_watcher * __watcher; for(__i = e->watchers_offset; __i < (e)->target_offset; __i += __watcher->watcher_size + sizeof(struct ebt_entry_watcher)) { __watcher = (void *) (e) + __i; __ret = fn(__watcher, ##args); if(__ret != 0) break; } if(__ret == 0) { if(__i != (e)->target_offset) __ret = - EINVAL; } __ret; \
141})
142#define EBT_ENTRY_ITERATE(entries,size,fn,args...) \
143({ unsigned int __i; int __ret = 0; struct ebt_entry * __entry; for(__i = 0; __i < (size);) { __entry = (void *) (entries) + __i; __ret = fn(__entry, ##args); if(__ret != 0) break; if(__entry->bitmask != 0) __i += __entry->next_offset; else __i += sizeof(struct ebt_entries); } if(__ret == 0) { if(__i != (size)) __ret = - EINVAL; } __ret; \
144})
145#endif
146