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