1
2
3
4
5
6
7
8
9#ifndef _UAPI_ARPTABLES_H
10#define _UAPI_ARPTABLES_H
11
12#include <linux/types.h>
13#include <linux/compiler.h>
14#include <linux/netfilter_arp.h>
15
16#include <linux/netfilter/x_tables.h>
17
18#ifndef __KERNEL__
19#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
20#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
21#define arpt_entry_target xt_entry_target
22#define arpt_standard_target xt_standard_target
23#define arpt_error_target xt_error_target
24#define ARPT_CONTINUE XT_CONTINUE
25#define ARPT_RETURN XT_RETURN
26#define arpt_counters_info xt_counters_info
27#define arpt_counters xt_counters
28#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
29#define ARPT_ERROR_TARGET XT_ERROR_TARGET
30#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
31 XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
32#endif
33
34#define ARPT_DEV_ADDR_LEN_MAX 16
35
36struct arpt_devaddr_info {
37 char addr[ARPT_DEV_ADDR_LEN_MAX];
38 char mask[ARPT_DEV_ADDR_LEN_MAX];
39};
40
41
42struct arpt_arp {
43
44 struct in_addr src, tgt;
45
46 struct in_addr smsk, tmsk;
47
48
49 __u8 arhln, arhln_mask;
50 struct arpt_devaddr_info src_devaddr;
51 struct arpt_devaddr_info tgt_devaddr;
52
53
54 __be16 arpop, arpop_mask;
55
56
57 __be16 arhrd, arhrd_mask;
58 __be16 arpro, arpro_mask;
59
60
61
62
63
64 char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
65 unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
66
67
68 __u8 flags;
69
70 __u16 invflags;
71};
72
73
74
75
76#define ARPT_F_MASK 0x00
77
78
79#define ARPT_INV_VIA_IN 0x0001
80#define ARPT_INV_VIA_OUT 0x0002
81#define ARPT_INV_SRCIP 0x0004
82#define ARPT_INV_TGTIP 0x0008
83#define ARPT_INV_SRCDEVADDR 0x0010
84#define ARPT_INV_TGTDEVADDR 0x0020
85#define ARPT_INV_ARPOP 0x0040
86#define ARPT_INV_ARPHRD 0x0080
87#define ARPT_INV_ARPPRO 0x0100
88#define ARPT_INV_ARPHLN 0x0200
89#define ARPT_INV_MASK 0x03FF
90
91
92
93
94struct arpt_entry
95{
96 struct arpt_arp arp;
97
98
99 __u16 target_offset;
100
101 __u16 next_offset;
102
103
104 unsigned int comefrom;
105
106
107 struct xt_counters counters;
108
109
110 unsigned char elems[0];
111};
112
113
114
115
116
117
118
119
120#define ARPT_BASE_CTL 96
121
122#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL)
123#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1)
124#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS
125
126#define ARPT_SO_GET_INFO (ARPT_BASE_CTL)
127#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1)
128
129#define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3)
130#define ARPT_SO_GET_MAX (ARPT_SO_GET_REVISION_TARGET)
131
132
133struct arpt_getinfo {
134
135 char name[XT_TABLE_MAXNAMELEN];
136
137
138
139 unsigned int valid_hooks;
140
141
142 unsigned int hook_entry[NF_ARP_NUMHOOKS];
143
144
145 unsigned int underflow[NF_ARP_NUMHOOKS];
146
147
148 unsigned int num_entries;
149
150
151 unsigned int size;
152};
153
154
155struct arpt_replace {
156
157 char name[XT_TABLE_MAXNAMELEN];
158
159
160
161 unsigned int valid_hooks;
162
163
164 unsigned int num_entries;
165
166
167 unsigned int size;
168
169
170 unsigned int hook_entry[NF_ARP_NUMHOOKS];
171
172
173 unsigned int underflow[NF_ARP_NUMHOOKS];
174
175
176
177 unsigned int num_counters;
178
179 struct xt_counters __user *counters;
180
181
182 struct arpt_entry entries[0];
183};
184
185
186struct arpt_get_entries {
187
188 char name[XT_TABLE_MAXNAMELEN];
189
190
191 unsigned int size;
192
193
194 struct arpt_entry entrytable[0];
195};
196
197
198static __inline__ struct xt_entry_target *arpt_get_target(struct arpt_entry *e)
199{
200 return (void *)e + e->target_offset;
201}
202
203
204
205
206#endif
207