This source file includes following definitions.
- ip6t_get_target
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #ifndef _UAPI_IP6_TABLES_H
17 #define _UAPI_IP6_TABLES_H
18
19 #include <linux/types.h>
20 #include <linux/compiler.h>
21 #include <linux/if.h>
22 #include <linux/netfilter_ipv6.h>
23
24 #include <linux/netfilter/x_tables.h>
25
26 #ifndef __KERNEL__
27 #define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
28 #define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
29 #define ip6t_match xt_match
30 #define ip6t_target xt_target
31 #define ip6t_table xt_table
32 #define ip6t_get_revision xt_get_revision
33 #define ip6t_entry_match xt_entry_match
34 #define ip6t_entry_target xt_entry_target
35 #define ip6t_standard_target xt_standard_target
36 #define ip6t_error_target xt_error_target
37 #define ip6t_counters xt_counters
38 #define IP6T_CONTINUE XT_CONTINUE
39 #define IP6T_RETURN XT_RETURN
40
41
42 #include <linux/netfilter/xt_tcpudp.h>
43 #define ip6t_tcp xt_tcp
44 #define ip6t_udp xt_udp
45 #define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT
46 #define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT
47 #define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS
48 #define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION
49 #define IP6T_TCP_INV_MASK XT_TCP_INV_MASK
50 #define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT
51 #define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT
52 #define IP6T_UDP_INV_MASK XT_UDP_INV_MASK
53
54 #define ip6t_counters_info xt_counters_info
55 #define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
56 #define IP6T_ERROR_TARGET XT_ERROR_TARGET
57 #define IP6T_MATCH_ITERATE(e, fn, args...) \
58 XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
59 #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
60 XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
61 #endif
62
63
64 struct ip6t_ip6 {
65
66 struct in6_addr src, dst;
67
68 struct in6_addr smsk, dmsk;
69 char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
70 unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
71
72
73
74
75
76
77
78
79
80 __u16 proto;
81
82 __u8 tos;
83
84
85 __u8 flags;
86
87 __u8 invflags;
88 };
89
90
91 #define IP6T_F_PROTO 0x01
92
93 #define IP6T_F_TOS 0x02
94 #define IP6T_F_GOTO 0x04
95 #define IP6T_F_MASK 0x07
96
97
98 #define IP6T_INV_VIA_IN 0x01
99 #define IP6T_INV_VIA_OUT 0x02
100 #define IP6T_INV_TOS 0x04
101 #define IP6T_INV_SRCIP 0x08
102 #define IP6T_INV_DSTIP 0x10
103 #define IP6T_INV_FRAG 0x20
104 #define IP6T_INV_PROTO XT_INV_PROTO
105 #define IP6T_INV_MASK 0x7F
106
107
108
109
110 struct ip6t_entry {
111 struct ip6t_ip6 ipv6;
112
113
114 unsigned int nfcache;
115
116
117 __u16 target_offset;
118
119 __u16 next_offset;
120
121
122 unsigned int comefrom;
123
124
125 struct xt_counters counters;
126
127
128 unsigned char elems[0];
129 };
130
131
132 struct ip6t_standard {
133 struct ip6t_entry entry;
134 struct xt_standard_target target;
135 };
136
137 struct ip6t_error {
138 struct ip6t_entry entry;
139 struct xt_error_target target;
140 };
141
142 #define IP6T_ENTRY_INIT(__size) \
143 { \
144 .target_offset = sizeof(struct ip6t_entry), \
145 .next_offset = (__size), \
146 }
147
148 #define IP6T_STANDARD_INIT(__verdict) \
149 { \
150 .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)), \
151 .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \
152 sizeof(struct xt_standard_target)), \
153 .target.verdict = -(__verdict) - 1, \
154 }
155
156 #define IP6T_ERROR_INIT \
157 { \
158 .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)), \
159 .target = XT_TARGET_INIT(XT_ERROR_TARGET, \
160 sizeof(struct xt_error_target)), \
161 .target.errorname = "ERROR", \
162 }
163
164
165
166
167
168
169
170
171 #define IP6T_BASE_CTL 64
172
173 #define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL)
174 #define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1)
175 #define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS
176
177 #define IP6T_SO_GET_INFO (IP6T_BASE_CTL)
178 #define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1)
179 #define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4)
180 #define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5)
181 #define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET
182
183
184 #define IP6T_SO_ORIGINAL_DST 80
185
186
187 struct ip6t_icmp {
188 __u8 type;
189 __u8 code[2];
190 __u8 invflags;
191 };
192
193
194 #define IP6T_ICMP_INV 0x01
195
196
197 struct ip6t_getinfo {
198
199 char name[XT_TABLE_MAXNAMELEN];
200
201
202
203 unsigned int valid_hooks;
204
205
206 unsigned int hook_entry[NF_INET_NUMHOOKS];
207
208
209 unsigned int underflow[NF_INET_NUMHOOKS];
210
211
212 unsigned int num_entries;
213
214
215 unsigned int size;
216 };
217
218
219 struct ip6t_replace {
220
221 char name[XT_TABLE_MAXNAMELEN];
222
223
224
225 unsigned int valid_hooks;
226
227
228 unsigned int num_entries;
229
230
231 unsigned int size;
232
233
234 unsigned int hook_entry[NF_INET_NUMHOOKS];
235
236
237 unsigned int underflow[NF_INET_NUMHOOKS];
238
239
240
241 unsigned int num_counters;
242
243 struct xt_counters __user *counters;
244
245
246 struct ip6t_entry entries[0];
247 };
248
249
250 struct ip6t_get_entries {
251
252 char name[XT_TABLE_MAXNAMELEN];
253
254
255 unsigned int size;
256
257
258 struct ip6t_entry entrytable[0];
259 };
260
261
262 static __inline__ struct xt_entry_target *
263 ip6t_get_target(struct ip6t_entry *e)
264 {
265 return (void *)e + e->target_offset;
266 }
267
268
269
270
271
272 #endif