]>
Commit | Line | Data |
---|---|---|
ae95cca4 PS |
1 | diff -uNr include.orig/linux/netfilter/ipv4/nf_conntrack_icmp.h include/linux/netfilter/ipv4/nf_conntrack_icmp.h |
2 | --- include.orig/linux/netfilter/ipv4/nf_conntrack_icmp.h 1970-01-01 01:00:00.000000000 +0100 | |
3 | +++ include/linux/netfilter/ipv4/nf_conntrack_icmp.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
4 | @@ -0,0 +1,17 @@ |
5 | +/* | |
6 | + * ICMP tracking. | |
7 | + * | |
8 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack_icmp.h | |
9 | + */ | |
ac0c4b1f | 10 | + |
014436e1 PS |
11 | +#ifndef _NF_CONNTRACK_ICMP_H |
12 | +#define _NF_CONNTRACK_ICMP_H | |
13 | +#include <asm/atomic.h> | |
ac0c4b1f | 14 | + |
014436e1 PS |
15 | +struct nf_ct_icmp |
16 | +{ | |
17 | + /* Optimization: when number in == number out, forget immediately. */ | |
18 | + atomic_t count; | |
19 | +}; | |
ac0c4b1f | 20 | + |
014436e1 | 21 | +#endif /* _NF_CONNTRACK_ICMP_H */ |
ae95cca4 PS |
22 | diff -uNr include.orig/linux/netfilter/ipv4/nf_conntrack_ipv4.h include/linux/netfilter/ipv4/nf_conntrack_ipv4.h |
23 | --- include.orig/linux/netfilter/ipv4/nf_conntrack_ipv4.h 1970-01-01 01:00:00.000000000 +0100 | |
24 | +++ include/linux/netfilter/ipv4/nf_conntrack_ipv4.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
25 | @@ -0,0 +1,40 @@ |
26 | +/* | |
27 | + * IPv4 support for nf_conntrack. | |
28 | + * | |
29 | + * 23 Mar 2004: Yasuyuki Kozakai @ USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
30 | + * - move L3 protocol dependent part from include/linux/netfilter_ipv4/ | |
31 | + * ip_conntarck.h | |
32 | + */ | |
0fc89030 | 33 | + |
014436e1 PS |
34 | +#ifndef _NF_CONNTRACK_IPV4_H |
35 | +#define _NF_CONNTRACK_IPV4_H | |
36 | + | |
37 | +#ifdef CONFIG_IP_NF_NAT_NEEDED | |
38 | +#include <linux/netfilter_ipv4/ip_nat.h> | |
39 | + | |
40 | +/* per conntrack: nat application helper private data */ | |
41 | +union ip_conntrack_nat_help { | |
42 | + /* insert nat helper private data here */ | |
43 | +}; | |
44 | + | |
45 | +struct nf_conntrack_ipv4_nat { | |
46 | + struct ip_nat_info info; | |
47 | + union ip_conntrack_nat_help help; | |
48 | +#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ | |
49 | + defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) | |
50 | + int masq_index; | |
51 | +#endif | |
52 | +}; | |
53 | +#endif /* CONFIG_IP_NF_NAT_NEEDED */ | |
54 | + | |
55 | +struct nf_conntrack_ipv4 { | |
56 | +#ifdef CONFIG_IP_NF_NAT_NEEDED | |
57 | + struct nf_conntrack_ipv4_nat *nat; | |
58 | +#endif | |
59 | +}; | |
60 | + | |
61 | +/* Returns new sk_buff, or NULL */ | |
62 | +struct sk_buff * | |
63 | +nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb); | |
64 | + | |
65 | +#endif /*_NF_CONNTRACK_IPV4_H*/ | |
ae95cca4 PS |
66 | diff -uNr include.orig/linux/netfilter/ipv6/nf_conntrack_icmpv6.h include/linux/netfilter/ipv6/nf_conntrack_icmpv6.h |
67 | --- include.orig/linux/netfilter/ipv6/nf_conntrack_icmpv6.h 1970-01-01 01:00:00.000000000 +0100 | |
68 | +++ include/linux/netfilter/ipv6/nf_conntrack_icmpv6.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
69 | @@ -0,0 +1,27 @@ |
70 | +/* | |
71 | + * ICMPv6 tracking. | |
72 | + * | |
73 | + * 21 Apl 2004: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
74 | + * - separated from nf_conntrack_icmp.h | |
75 | + * | |
76 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack_icmp.h | |
77 | + */ | |
78 | + | |
79 | +#ifndef _NF_CONNTRACK_ICMPV6_H | |
80 | +#define _NF_CONNTRACK_ICMPV6_H | |
81 | +#include <asm/atomic.h> | |
82 | + | |
83 | +#ifndef ICMPV6_NI_QUERY | |
84 | +#define ICMPV6_NI_QUERY 139 | |
85 | +#endif | |
86 | +#ifndef ICMPV6_NI_REPLY | |
87 | +#define ICMPV6_NI_REPLY 140 | |
88 | +#endif | |
89 | + | |
90 | +struct nf_ct_icmpv6 | |
91 | +{ | |
92 | + /* Optimization: when number in == number out, forget immediately. */ | |
93 | + atomic_t count; | |
94 | +}; | |
95 | + | |
96 | +#endif /* _NF_CONNTRACK_ICMPV6_H */ | |
ae95cca4 PS |
97 | diff -uNr include.orig/linux/netfilter/nf_conntrack_core.h include/linux/netfilter/nf_conntrack_core.h |
98 | --- include.orig/linux/netfilter/nf_conntrack_core.h 1970-01-01 01:00:00.000000000 +0100 | |
99 | +++ include/linux/netfilter/nf_conntrack_core.h 2005-05-06 22:28:14.000000000 +0200 | |
100 | @@ -0,0 +1,71 @@ | |
014436e1 PS |
101 | +/* |
102 | + * This header is used to share core functionality between the | |
103 | + * standalone connection tracking module, and the compatibility layer's use | |
104 | + * of connection tracking. | |
105 | + * | |
106 | + * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
107 | + * - generalize L3 protocol dependent part. | |
108 | + * | |
109 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack_core.h | |
110 | + */ | |
111 | + | |
112 | +#ifndef _NF_CONNTRACK_CORE_H | |
113 | +#define _NF_CONNTRACK_CORE_H | |
114 | + | |
115 | +#include <linux/netfilter.h> | |
014436e1 PS |
116 | + |
117 | +/* This header is used to share core functionality between the | |
118 | + standalone connection tracking module, and the compatibility layer's use | |
119 | + of connection tracking. */ | |
120 | +extern unsigned int nf_conntrack_in(int pf, | |
121 | + unsigned int hooknum, | |
122 | + struct sk_buff **pskb); | |
123 | + | |
124 | +extern int nf_conntrack_init(void); | |
125 | +extern void nf_conntrack_cleanup(void); | |
126 | + | |
127 | +struct nf_conntrack_l3proto; | |
128 | +extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); | |
129 | +/* Like above, but you already have conntrack read lock. */ | |
130 | +extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto); | |
131 | + | |
132 | +struct nf_conntrack_protocol; | |
133 | + | |
134 | +extern int | |
135 | +nf_ct_get_tuple(const struct sk_buff *skb, | |
136 | + unsigned int nhoff, | |
137 | + unsigned int dataoff, | |
138 | + u_int16_t l3num, | |
139 | + u_int8_t protonum, | |
140 | + struct nf_conntrack_tuple *tuple, | |
141 | + const struct nf_conntrack_l3proto *l3proto, | |
142 | + const struct nf_conntrack_protocol *protocol); | |
143 | + | |
144 | +extern int | |
145 | +nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, | |
146 | + const struct nf_conntrack_tuple *orig, | |
147 | + const struct nf_conntrack_l3proto *l3proto, | |
148 | + const struct nf_conntrack_protocol *protocol); | |
149 | + | |
150 | +/* Find a connection corresponding to a tuple. */ | |
151 | +extern struct nf_conntrack_tuple_hash * | |
152 | +nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple, | |
153 | + const struct nf_conn *ignored_conntrack); | |
154 | + | |
155 | +extern int __nf_conntrack_confirm(struct sk_buff **pskb); | |
156 | + | |
157 | +/* Confirm a connection: returns NF_DROP if packet must be dropped. */ | |
158 | +static inline int nf_conntrack_confirm(struct sk_buff **pskb) | |
159 | +{ | |
160 | + if ((*pskb)->nfct | |
161 | + && !is_confirmed((struct nf_conn *)(*pskb)->nfct)) | |
162 | + return __nf_conntrack_confirm(pskb); | |
163 | + return NF_ACCEPT; | |
164 | +} | |
165 | + | |
166 | +extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb); | |
167 | + | |
168 | +extern struct list_head *nf_conntrack_hash; | |
169 | +extern struct list_head nf_conntrack_expect_list; | |
170 | +DECLARE_RWLOCK_EXTERN(nf_conntrack_lock); | |
171 | +#endif /* _NF_CONNTRACK_CORE_H */ | |
ae95cca4 PS |
172 | diff -uNr include.orig/linux/netfilter/nf_conntrack_ftp.h include/linux/netfilter/nf_conntrack_ftp.h |
173 | --- include.orig/linux/netfilter/nf_conntrack_ftp.h 1970-01-01 01:00:00.000000000 +0100 | |
174 | +++ include/linux/netfilter/nf_conntrack_ftp.h 2005-05-06 22:08:00.000000000 +0200 | |
014436e1 PS |
175 | @@ -0,0 +1,48 @@ |
176 | +/* | |
177 | + * nf_conntrack_ftp.h | |
178 | + * | |
179 | + * Definitions and Declarations for FTP tracking. | |
180 | + * | |
181 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack_ftp.h | |
182 | + * | |
183 | + * 16 Dec 2003: Yasuyuki Kozakai @ USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
184 | + * - IPv6 support. | |
185 | + */ | |
186 | + | |
187 | +#ifndef _NF_CONNTRACK_FTP_H | |
188 | +#define _NF_CONNTRACK_FTP_H | |
189 | +/* FTP tracking. */ | |
190 | + | |
191 | +enum nf_ct_ftp_type | |
192 | +{ | |
193 | + /* PORT command from client */ | |
194 | + NF_CT_FTP_PORT, | |
195 | + /* PASV response from server */ | |
196 | + NF_CT_FTP_PASV, | |
197 | + /* EPRT command from client */ | |
198 | + NF_CT_FTP_EPRT, | |
199 | + /* EPSV response from server */ | |
200 | + NF_CT_FTP_EPSV, | |
201 | +}; | |
202 | + | |
203 | +#define NUM_SEQ_TO_REMEMBER 2 | |
204 | +/* This structure exists only once per master */ | |
205 | +struct nf_ct_ftp_master { | |
206 | + /* Valid seq positions for cmd matching after newline */ | |
207 | + u_int32_t seq_aft_nl[NF_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER]; | |
208 | + /* 0 means seq_match_aft_nl not set */ | |
209 | + int seq_aft_nl_num[NF_CT_DIR_MAX]; | |
210 | +}; | |
211 | + | |
212 | +struct nf_conntrack_expect; | |
213 | + | |
214 | +/* For NAT to hook in when we find a packet which describes what other | |
215 | + * connection we should expect. */ | |
216 | +extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff **pskb, | |
217 | + enum nf_conntrack_info ctinfo, | |
218 | + enum nf_ct_ftp_type type, | |
219 | + unsigned int matchoff, | |
220 | + unsigned int matchlen, | |
221 | + struct nf_conntrack_expect *exp, | |
222 | + u32 *seq); | |
223 | +#endif /* _NF_CONNTRACK_FTP_H */ | |
ae95cca4 PS |
224 | diff -uNr include.orig/linux/netfilter/nf_conntrack.h include/linux/netfilter/nf_conntrack.h |
225 | --- include.orig/linux/netfilter/nf_conntrack.h 1970-01-01 01:00:00.000000000 +0100 | |
226 | +++ include/linux/netfilter/nf_conntrack.h 2005-05-06 22:07:48.000000000 +0200 | |
014436e1 PS |
227 | @@ -0,0 +1,54 @@ |
228 | +/* | |
229 | + * Connection state tracking for netfilter. This is separated from, | |
230 | + * but required by, the (future) NAT layer; it can also be used by an iptables | |
231 | + * extension. | |
232 | + * | |
233 | + * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
234 | + * - generalize L3 protocol dependent part. | |
235 | + * | |
236 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack.h | |
237 | + */ | |
238 | + | |
239 | +#ifndef _NF_CONNTRACK_H | |
240 | +#define _NF_CONNTRACK_H | |
241 | + | |
242 | +enum nf_conntrack_info | |
243 | +{ | |
244 | + /* Part of an established connection (either direction). */ | |
245 | + NF_CT_ESTABLISHED, | |
246 | + | |
247 | + /* Like NEW, but related to an existing connection, or ICMP error | |
248 | + (in either direction). */ | |
249 | + NF_CT_RELATED, | |
250 | + | |
251 | + /* Started a new connection to track (only | |
252 | + NF_CT_DIR_ORIGINAL); may be a retransmission. */ | |
253 | + NF_CT_NEW, | |
254 | + | |
255 | + /* >= this indicates reply direction */ | |
256 | + NF_CT_IS_REPLY, | |
257 | + | |
258 | + /* Number of distinct NF_CT types (no NEW in reply dirn). */ | |
259 | + NF_CT_NUMBER = NF_CT_IS_REPLY * 2 - 1 | |
260 | +}; | |
261 | + | |
262 | +/* Bitset representing status of connection. */ | |
263 | +enum nf_conntrack_status { | |
264 | + /* It's an expected connection: bit 0 set. This bit never changed */ | |
265 | + NF_S_EXPECTED_BIT = 0, | |
266 | + NF_S_EXPECTED = (1 << NF_S_EXPECTED_BIT), | |
267 | + | |
268 | + /* We've seen packets both ways: bit 1 set. Can be set, not unset. */ | |
269 | + NF_S_SEEN_REPLY_BIT = 1, | |
270 | + NF_S_SEEN_REPLY = (1 << NF_S_SEEN_REPLY_BIT), | |
271 | + | |
272 | + /* Conntrack should never be early-expired. */ | |
273 | + NF_S_ASSURED_BIT = 2, | |
274 | + NF_S_ASSURED = (1 << NF_S_ASSURED_BIT), | |
275 | + | |
276 | + /* Connection is confirmed: originating packet has left box */ | |
277 | + NF_S_CONFIRMED_BIT = 3, | |
278 | + NF_S_CONFIRMED = (1 << NF_S_CONFIRMED_BIT), | |
279 | +}; | |
280 | + | |
281 | +#endif /* _NF_CONNTRACK_H */ | |
ae95cca4 PS |
282 | diff -uNr include.orig/linux/netfilter/nf_conntrack_helper.h include/linux/netfilter/nf_conntrack_helper.h |
283 | --- include.orig/linux/netfilter/nf_conntrack_helper.h 1970-01-01 01:00:00.000000000 +0100 | |
284 | +++ include/linux/netfilter/nf_conntrack_helper.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
285 | @@ -0,0 +1,50 @@ |
286 | +/* | |
287 | + * connection tracking helpers. | |
288 | + * | |
289 | + * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
290 | + * - generalize L3 protocol dependent part. | |
291 | + * | |
292 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack_helper.h | |
293 | + */ | |
294 | + | |
295 | +#ifndef _NF_CONNTRACK_HELPER_H | |
296 | +#define _NF_CONNTRACK_HELPER_H | |
297 | +#include <linux/netfilter/nf_conntrack.h> | |
298 | + | |
299 | +struct module; | |
300 | + | |
301 | +struct nf_conntrack_helper | |
302 | +{ | |
303 | + struct list_head list; /* Internal use. */ | |
304 | + | |
305 | + const char *name; /* name of the module */ | |
306 | + struct module *me; /* pointer to self */ | |
307 | + unsigned int max_expected; /* Maximum number of concurrent | |
308 | + * expected connections */ | |
309 | + unsigned int timeout; /* timeout for expecteds */ | |
310 | + | |
311 | + /* Mask of things we will help (compared against server response) */ | |
312 | + struct nf_conntrack_tuple tuple; | |
313 | + struct nf_conntrack_tuple mask; | |
314 | + | |
315 | + /* Function to call when data passes; return verdict, or -1 to | |
316 | + invalidate. */ | |
317 | + int (*help)(struct sk_buff **pskb, | |
318 | + unsigned int protoff, | |
319 | + struct nf_conn *ct, | |
320 | + enum nf_conntrack_info conntrackinfo); | |
321 | +}; | |
322 | + | |
323 | +extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); | |
324 | +extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); | |
325 | + | |
326 | +/* Allocate space for an expectation: this is mandatory before calling | |
327 | + nf_conntrack_expect_related. */ | |
328 | +extern struct nf_conntrack_expect *nf_conntrack_expect_alloc(void); | |
329 | +extern void nf_conntrack_expect_free(struct nf_conntrack_expect *exp); | |
330 | + | |
331 | +/* Add an expected connection: can have more than one per connection */ | |
332 | +extern int nf_conntrack_expect_related(struct nf_conntrack_expect *exp); | |
333 | +extern void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp); | |
334 | + | |
335 | +#endif /*_NF_CONNTRACK_HELPER_H*/ | |
ae95cca4 PS |
336 | diff -uNr include.orig/linux/netfilter/nf_conntrack_l3proto.h include/linux/netfilter/nf_conntrack_l3proto.h |
337 | --- include.orig/linux/netfilter/nf_conntrack_l3proto.h 1970-01-01 01:00:00.000000000 +0100 | |
338 | +++ include/linux/netfilter/nf_conntrack_l3proto.h 2005-05-06 22:27:57.000000000 +0200 | |
339 | @@ -0,0 +1,92 @@ | |
014436e1 PS |
340 | +/* |
341 | + * Copyright (C)2003,2004 USAGI/WIDE Project | |
342 | + * | |
343 | + * Header for use in defining a given L3 protocol for connection tracking. | |
344 | + * | |
345 | + * Author: | |
346 | + * Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
347 | + * | |
348 | + * Derived from include/netfilter_ipv4/ip_conntrack_protocol.h | |
349 | + */ | |
350 | + | |
351 | +#ifndef _NF_CONNTRACK_L3PROTO_H | |
352 | +#define _NF_CONNTRACK_L3PROTO_H | |
014436e1 PS |
353 | +#include <linux/netfilter/nf_conntrack.h> |
354 | + | |
355 | +struct nf_conntrack_l3proto | |
356 | +{ | |
357 | + /* Next pointer. */ | |
358 | + struct list_head list; | |
359 | + | |
360 | + /* L3 Protocol Family number. ex) PF_INET */ | |
361 | + u_int16_t l3proto; | |
362 | + | |
363 | + /* Protocol name */ | |
364 | + const char *name; | |
365 | + | |
366 | + /* | |
367 | + * Try to fill in the third arg: nhoff is offset of l3 proto | |
368 | + * hdr. Return true if possible. | |
369 | + */ | |
370 | + int (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff, | |
371 | + struct nf_conntrack_tuple *tuple); | |
372 | + | |
373 | + /* | |
374 | + * Invert the per-proto part of the tuple: ie. turn xmit into reply. | |
375 | + * Some packets can't be inverted: return 0 in that case. | |
376 | + */ | |
377 | + int (*invert_tuple)(struct nf_conntrack_tuple *inverse, | |
378 | + const struct nf_conntrack_tuple *orig); | |
379 | + | |
380 | + /* Print out the per-protocol part of the tuple. */ | |
381 | + int (*print_tuple)(struct seq_file *s, | |
382 | + const struct nf_conntrack_tuple *); | |
383 | + | |
384 | + /* Print out the private part of the conntrack. */ | |
385 | + int (*print_conntrack)(struct seq_file *s, const struct nf_conn *); | |
386 | + | |
387 | + /* Returns verdict for packet, or -1 for invalid. */ | |
388 | + int (*packet)(struct nf_conn *conntrack, | |
389 | + const struct sk_buff *skb, | |
390 | + enum nf_conntrack_info ctinfo); | |
391 | + | |
392 | + /* | |
393 | + * Called when a new connection for this protocol found; | |
394 | + * returns TRUE if it's OK. If so, packet() called next. | |
395 | + */ | |
396 | + int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb); | |
397 | + | |
398 | + /* Called when a conntrack entry is destroyed */ | |
399 | + void (*destroy)(struct nf_conn *conntrack); | |
400 | + | |
401 | + /* | |
402 | + * Called before tracking. | |
403 | + * *dataoff: offset of protocol header (TCP, UDP,...) in *pskb | |
404 | + * *protonum: protocol number | |
405 | + */ | |
406 | + int (*prepare)(struct sk_buff **pskb, unsigned int hooknum, | |
407 | + unsigned int *dataoff, u_int8_t *protonum, int *ret); | |
408 | + | |
409 | + u_int32_t (*get_features)(const struct nf_conntrack_tuple *tuple); | |
410 | + | |
411 | + /* Module (if any) which this is connected to. */ | |
412 | + struct module *me; | |
413 | +}; | |
414 | + | |
415 | +extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX]; | |
416 | + | |
417 | +/* Protocol registration. */ | |
418 | +extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); | |
419 | +extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); | |
420 | + | |
421 | +static inline struct nf_conntrack_l3proto * | |
422 | +nf_ct_find_l3proto(u_int16_t l3proto) | |
423 | +{ | |
424 | + return nf_ct_l3protos[l3proto]; | |
425 | +} | |
426 | + | |
427 | +/* Existing built-in protocols */ | |
428 | +extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; | |
429 | +extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6; | |
430 | +extern struct nf_conntrack_l3proto nf_conntrack_generic_l3proto; | |
431 | +#endif /*_NF_CONNTRACK_L3PROTO_H*/ | |
ae95cca4 PS |
432 | diff -uNr include.orig/linux/netfilter/nf_conntrack_protocol.h include/linux/netfilter/nf_conntrack_protocol.h |
433 | --- include.orig/linux/netfilter/nf_conntrack_protocol.h 1970-01-01 01:00:00.000000000 +0100 | |
434 | +++ include/linux/netfilter/nf_conntrack_protocol.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
435 | @@ -0,0 +1,105 @@ |
436 | +/* | |
437 | + * Header for use in defining a given protocol for connection tracking. | |
438 | + * | |
439 | + * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
440 | + * - generalized L3 protocol dependent part. | |
441 | + * | |
442 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack_protcol.h | |
443 | + */ | |
444 | + | |
445 | +#ifndef _NF_CONNTRACK_PROTOCOL_H | |
446 | +#define _NF_CONNTRACK_PROTOCOL_H | |
447 | +#include <linux/netfilter/nf_conntrack.h> | |
448 | + | |
449 | +struct seq_file; | |
450 | + | |
451 | +struct nf_conntrack_protocol | |
452 | +{ | |
453 | + /* Next pointer. */ | |
454 | + struct list_head list; | |
455 | + | |
456 | + /* L3 Protocol number. */ | |
457 | + u_int16_t l3proto; | |
458 | + | |
459 | + /* Protocol number. */ | |
460 | + u_int8_t proto; | |
461 | + | |
462 | + /* Protocol name */ | |
463 | + const char *name; | |
464 | + | |
465 | + /* Try to fill in the third arg: dataoff is offset past network protocol | |
466 | + hdr. Return true if possible. */ | |
467 | + int (*pkt_to_tuple)(const struct sk_buff *skb, | |
468 | + unsigned int dataoff, | |
469 | + struct nf_conntrack_tuple *tuple); | |
470 | + | |
471 | + /* Invert the per-proto part of the tuple: ie. turn xmit into reply. | |
472 | + * Some packets can't be inverted: return 0 in that case. | |
473 | + */ | |
474 | + int (*invert_tuple)(struct nf_conntrack_tuple *inverse, | |
475 | + const struct nf_conntrack_tuple *orig); | |
476 | + | |
477 | + /* Print out the per-protocol part of the tuple. Return like seq_* */ | |
478 | + int (*print_tuple)(struct seq_file *s, | |
479 | + const struct nf_conntrack_tuple *); | |
480 | + | |
481 | + /* Print out the private part of the conntrack. */ | |
482 | + int (*print_conntrack)(struct seq_file *s, const struct nf_conn *); | |
483 | + | |
484 | + /* Returns verdict for packet, or -1 for invalid. */ | |
485 | + int (*packet)(struct nf_conn *conntrack, | |
486 | + const struct sk_buff *skb, | |
487 | + unsigned int dataoff, | |
488 | + enum nf_conntrack_info ctinfo, | |
489 | + int pf, | |
490 | + unsigned int hooknum); | |
491 | + | |
492 | + /* Called when a new connection for this protocol found; | |
493 | + * returns TRUE if it's OK. If so, packet() called next. */ | |
494 | + int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb, | |
495 | + unsigned int dataoff); | |
496 | + | |
497 | + /* Called when a conntrack entry is destroyed */ | |
498 | + void (*destroy)(struct nf_conn *conntrack); | |
499 | + | |
500 | + int (*error)(struct sk_buff *skb, unsigned int dataoff, | |
501 | + enum nf_conntrack_info *ctinfo, | |
502 | + int pf, unsigned int hooknum); | |
503 | + | |
504 | + /* Module (if any) which this is connected to. */ | |
505 | + struct module *me; | |
506 | +}; | |
507 | + | |
508 | +/* Existing built-in protocols */ | |
509 | +extern struct nf_conntrack_protocol nf_conntrack_protocol_tcp6; | |
510 | +extern struct nf_conntrack_protocol nf_conntrack_protocol_udp4; | |
511 | +extern struct nf_conntrack_protocol nf_conntrack_protocol_udp6; | |
512 | +extern struct nf_conntrack_protocol nf_conntrack_generic_protocol; | |
513 | + | |
514 | +#define MAX_NF_CT_PROTO 256 | |
515 | +extern struct nf_conntrack_protocol **nf_ct_protos[PF_MAX]; | |
516 | + | |
517 | +extern struct nf_conntrack_protocol * | |
518 | +nf_ct_find_proto(u_int16_t l3proto, u_int8_t protocol); | |
519 | + | |
520 | +/* Protocol registration. */ | |
521 | +extern int nf_conntrack_protocol_register(struct nf_conntrack_protocol *proto); | |
522 | +extern void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto); | |
523 | + | |
524 | +/* Log invalid packets */ | |
525 | +extern unsigned int nf_ct_log_invalid; | |
526 | + | |
527 | +#ifdef CONFIG_SYSCTL | |
528 | +#ifdef DEBUG_INVALID_PACKETS | |
529 | +#define LOG_INVALID(proto) \ | |
530 | + (nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) | |
0fc89030 | 531 | +#else |
014436e1 PS |
532 | +#define LOG_INVALID(proto) \ |
533 | + ((nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) \ | |
534 | + && net_ratelimit()) | |
0fc89030 | 535 | +#endif |
014436e1 PS |
536 | +#else |
537 | +#define LOG_INVALID(proto) 0 | |
538 | +#endif /* CONFIG_SYSCTL */ | |
539 | + | |
540 | +#endif /*_NF_CONNTRACK_PROTOCOL_H*/ | |
ae95cca4 PS |
541 | diff -uNr include.orig/linux/netfilter/nf_conntrack_sctp.h include/linux/netfilter/nf_conntrack_sctp.h |
542 | --- include.orig/linux/netfilter/nf_conntrack_sctp.h 1970-01-01 01:00:00.000000000 +0100 | |
543 | +++ include/linux/netfilter/nf_conntrack_sctp.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
544 | @@ -0,0 +1,30 @@ |
545 | +/* | |
546 | + * SCTP tracking. | |
547 | + * | |
548 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack_tcp.h | |
549 | + */ | |
550 | + | |
551 | +#ifndef _NF_CONNTRACK_SCTP_H | |
552 | +#define _NF_CONNTRACK_SCTP_H | |
553 | + | |
554 | +enum sctp_conntrack { | |
555 | + SCTP_CONNTRACK_NONE, | |
556 | + SCTP_CONNTRACK_CLOSED, | |
557 | + SCTP_CONNTRACK_COOKIE_WAIT, | |
558 | + SCTP_CONNTRACK_COOKIE_ECHOED, | |
559 | + SCTP_CONNTRACK_ESTABLISHED, | |
560 | + SCTP_CONNTRACK_SHUTDOWN_SENT, | |
561 | + SCTP_CONNTRACK_SHUTDOWN_RECD, | |
562 | + SCTP_CONNTRACK_SHUTDOWN_ACK_SENT, | |
563 | + SCTP_CONNTRACK_MAX | |
0fc89030 PS |
564 | +}; |
565 | + | |
014436e1 PS |
566 | +struct nf_ct_sctp |
567 | +{ | |
568 | + enum sctp_conntrack state; | |
569 | + | |
570 | + u_int32_t vtag[NF_CT_DIR_MAX]; | |
571 | + u_int32_t ttag[NF_CT_DIR_MAX]; | |
0fc89030 PS |
572 | +}; |
573 | + | |
014436e1 | 574 | +#endif /* _NF_CONNTRACK_SCTP_H */ |
ae95cca4 PS |
575 | diff -uNr include.orig/linux/netfilter/nf_conntrack_tcp.h include/linux/netfilter/nf_conntrack_tcp.h |
576 | --- include.orig/linux/netfilter/nf_conntrack_tcp.h 1970-01-01 01:00:00.000000000 +0100 | |
577 | +++ include/linux/netfilter/nf_conntrack_tcp.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
578 | @@ -0,0 +1,63 @@ |
579 | +/* | |
580 | + * TCP tracking. | |
581 | + * | |
582 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack_tcp.h | |
583 | + */ | |
584 | + | |
585 | +#ifndef _NF_CONNTRACK_TCP_H | |
586 | +#define _NF_CONNTRACK_TCP_H | |
0fc89030 | 587 | + |
014436e1 PS |
588 | +enum tcp_conntrack { |
589 | + TCP_CONNTRACK_NONE, | |
590 | + TCP_CONNTRACK_SYN_SENT, | |
591 | + TCP_CONNTRACK_SYN_RECV, | |
592 | + TCP_CONNTRACK_ESTABLISHED, | |
593 | + TCP_CONNTRACK_FIN_WAIT, | |
594 | + TCP_CONNTRACK_CLOSE_WAIT, | |
595 | + TCP_CONNTRACK_LAST_ACK, | |
596 | + TCP_CONNTRACK_TIME_WAIT, | |
597 | + TCP_CONNTRACK_CLOSE, | |
598 | + TCP_CONNTRACK_LISTEN, | |
599 | + TCP_CONNTRACK_MAX, | |
600 | + TCP_CONNTRACK_IGNORE | |
0fc89030 PS |
601 | +}; |
602 | + | |
014436e1 PS |
603 | +/* Window scaling is advertised by the sender */ |
604 | +#define NF_CT_TCP_FLAG_WINDOW_SCALE 0x01 | |
605 | + | |
606 | +/* SACK is permitted by the sender */ | |
607 | +#define NF_CT_TCP_FLAG_SACK_PERM 0x02 | |
608 | + | |
609 | +struct nf_ct_tcp_state { | |
610 | + u_int32_t td_end; /* max of seq + len */ | |
611 | + u_int32_t td_maxend; /* max of ack + max(win, 1) */ | |
612 | + u_int32_t td_maxwin; /* max(win) */ | |
613 | + u_int8_t td_scale; /* window scale factor */ | |
614 | + u_int8_t loose; /* used when connection picked up from the middle */ | |
615 | + u_int8_t flags; /* per direction state flags */ | |
0fc89030 PS |
616 | +}; |
617 | + | |
014436e1 PS |
618 | +struct nf_ct_tcp |
619 | +{ | |
620 | + struct nf_ct_tcp_state seen[2]; /* connection parameters per direction */ | |
621 | + u_int8_t state; /* state of the connection (enum tcp_conntrack) */ | |
622 | + /* For detecting stale connections */ | |
623 | + u_int8_t last_dir; /* Direction of the last packet (enum nf_conntrack_dir) */ | |
624 | + u_int8_t retrans; /* Number of retransmitted packets */ | |
625 | + u_int8_t last_index; /* Index of the last packet */ | |
626 | + u_int32_t last_seq; /* Last sequence number seen in dir */ | |
627 | + u_int32_t last_ack; /* Last sequence number seen in opposite dir */ | |
628 | + u_int32_t last_end; /* Last seq + len */ | |
629 | +}; | |
630 | + | |
631 | +/* Need this, since this file is included before the nf_conn definition | |
632 | + * in nf_conntrack.h */ | |
633 | +struct nf_conn; | |
634 | + | |
635 | +/* Update TCP window tracking data when NAT mangles the packet */ | |
636 | +extern void nf_conntrack_tcp_update(struct sk_buff *skb, | |
637 | + unsigned int dataoff, | |
638 | + struct nf_conn *conntrack, | |
639 | + int dir); | |
640 | + | |
641 | +#endif /* _NF_CONNTRACK_TCP_H */ | |
ae95cca4 PS |
642 | diff -uNr include.orig/linux/netfilter/nf_conntrack_tuple.h include/linux/netfilter/nf_conntrack_tuple.h |
643 | --- include.orig/linux/netfilter/nf_conntrack_tuple.h 1970-01-01 01:00:00.000000000 +0100 | |
644 | +++ include/linux/netfilter/nf_conntrack_tuple.h 2005-05-06 22:08:08.000000000 +0200 | |
014436e1 PS |
645 | @@ -0,0 +1,177 @@ |
646 | +/* | |
647 | + * Definitions and Declarations for tuple. | |
648 | + * | |
649 | + * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> | |
650 | + * - generalize L3 protocol dependent part. | |
651 | + * | |
652 | + * Derived from include/linux/netfiter_ipv4/ip_conntrack_tuple.h | |
653 | + */ | |
0fc89030 | 654 | + |
014436e1 PS |
655 | +#ifndef _NF_CONNTRACK_TUPLE_H |
656 | +#define _NF_CONNTRACK_TUPLE_H | |
0fc89030 | 657 | + |
014436e1 PS |
658 | +/* A `tuple' is a structure containing the information to uniquely |
659 | + identify a connection. ie. if two packets have the same tuple, they | |
660 | + are in the same connection; if not, they are not. | |
661 | + | |
662 | + We divide the structure along "manipulatable" and | |
663 | + "non-manipulatable" lines, for the benefit of the NAT code. | |
664 | +*/ | |
0fc89030 | 665 | + |
014436e1 PS |
666 | +#define NF_CT_TUPLE_L3SIZE 4 |
667 | + | |
668 | +/* The l3 protocol-specific manipulable parts of the tuple: always in | |
669 | + network order! */ | |
670 | +union nf_conntrack_man_l3proto { | |
671 | + u_int32_t all[NF_CT_TUPLE_L3SIZE]; | |
672 | + u_int32_t ip; | |
673 | + u_int32_t ip6[4]; | |
0fc89030 PS |
674 | +}; |
675 | + | |
014436e1 PS |
676 | +/* The protocol-specific manipulable parts of the tuple: always in |
677 | + network order! */ | |
678 | +union nf_conntrack_man_proto | |
679 | +{ | |
680 | + /* Add other protocols here. */ | |
681 | + u_int16_t all; | |
682 | + | |
0fc89030 | 683 | + struct { |
014436e1 PS |
684 | + u_int16_t port; |
685 | + } tcp; | |
686 | + struct { | |
687 | + u_int16_t port; | |
688 | + } udp; | |
689 | + struct { | |
690 | + u_int16_t id; | |
691 | + } icmp; | |
692 | + struct { | |
693 | + u_int16_t port; | |
694 | + } sctp; | |
695 | +}; | |
696 | + | |
697 | +/* The manipulable part of the tuple. */ | |
698 | +struct nf_conntrack_man | |
699 | +{ | |
700 | + union nf_conntrack_man_l3proto u3; | |
701 | + union nf_conntrack_man_proto u; | |
702 | + /* Layer 3 protocol */ | |
703 | + u_int16_t l3num; | |
704 | +}; | |
705 | + | |
706 | +/* This contains the information to distinguish a connection. */ | |
707 | +struct nf_conntrack_tuple | |
708 | +{ | |
709 | + struct nf_conntrack_man src; | |
710 | + | |
711 | + /* These are the parts of the tuple which are fixed. */ | |
712 | + struct { | |
713 | + union { | |
714 | + u_int32_t all[NF_CT_TUPLE_L3SIZE]; | |
715 | + u_int32_t ip; | |
716 | + u_int32_t ip6[4]; | |
717 | + } u3; | |
718 | + union { | |
719 | + /* Add other protocols here. */ | |
720 | + u_int16_t all; | |
721 | + | |
0fc89030 | 722 | + struct { |
014436e1 PS |
723 | + u_int16_t port; |
724 | + } tcp; | |
725 | + struct { | |
726 | + u_int16_t port; | |
727 | + } udp; | |
728 | + struct { | |
729 | + u_int8_t type, code; | |
730 | + } icmp; | |
731 | + struct { | |
732 | + u_int16_t port; | |
733 | + } sctp; | |
734 | + } u; | |
735 | + | |
736 | + /* The protocol. */ | |
737 | + u_int8_t protonum; | |
738 | + | |
739 | + /* The direction (for tuplehash) */ | |
740 | + u_int8_t dir; | |
741 | + } dst; | |
742 | +}; | |
743 | + | |
744 | +/* This is optimized opposed to a memset of the whole structure. Everything we | |
745 | + * really care about is the source/destination unions */ | |
746 | +#define NF_CT_TUPLE_U_BLANK(tuple) \ | |
747 | + do { \ | |
748 | + (tuple)->src.u.all = 0; \ | |
749 | + (tuple)->dst.u.all = 0; \ | |
750 | + memset((tuple)->src.u3.all, 0, \ | |
751 | + sizeof(u_int32_t)*NF_CT_TUPLE_L3SIZE); \ | |
752 | + memset((tuple)->dst.u3.all, 0, \ | |
753 | + sizeof(u_int32_t)*NF_CT_TUPLE_L3SIZE); \ | |
754 | + } while (0) | |
755 | + | |
756 | +enum nf_conntrack_dir | |
757 | +{ | |
758 | + NF_CT_DIR_ORIGINAL, | |
759 | + NF_CT_DIR_REPLY, | |
760 | + NF_CT_DIR_MAX | |
761 | +}; | |
762 | + | |
763 | +static inline int nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, | |
764 | + const struct nf_conntrack_tuple *t2) | |
765 | +{ | |
766 | + return (t1->src.u3.all[0] == t2->src.u3.all[0] && | |
767 | + t1->src.u3.all[1] == t2->src.u3.all[1] && | |
768 | + t1->src.u3.all[2] == t2->src.u3.all[2] && | |
769 | + t1->src.u3.all[3] == t2->src.u3.all[3] && | |
770 | + t1->src.u.all == t2->src.u.all && | |
771 | + t1->src.l3num == t2->src.l3num && | |
772 | + t1->dst.protonum == t2->dst.protonum); | |
773 | +} | |
774 | + | |
775 | +static inline int nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, | |
776 | + const struct nf_conntrack_tuple *t2) | |
777 | +{ | |
778 | + return (t1->dst.u3.all[0] == t2->dst.u3.all[0] && | |
779 | + t1->dst.u3.all[1] == t2->dst.u3.all[1] && | |
780 | + t1->dst.u3.all[2] == t2->dst.u3.all[2] && | |
781 | + t1->dst.u3.all[3] == t2->dst.u3.all[3] && | |
782 | + t1->dst.u.all == t2->dst.u.all && | |
783 | + t1->src.l3num == t2->src.l3num && | |
784 | + t1->dst.protonum == t2->dst.protonum); | |
785 | +} | |
786 | + | |
787 | +static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, | |
788 | + const struct nf_conntrack_tuple *t2) | |
789 | +{ | |
790 | + return nf_ct_tuple_src_equal(t1, t2) && nf_ct_tuple_dst_equal(t1, t2); | |
791 | +} | |
792 | + | |
793 | +static inline int nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t, | |
794 | + const struct nf_conntrack_tuple *tuple, | |
795 | + const struct nf_conntrack_tuple *mask) | |
796 | +{ | |
797 | + int count = 0; | |
798 | + | |
799 | + for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++){ | |
800 | + if ((ntohs(t->src.u3.all[count]) ^ | |
801 | + ntohs(tuple->src.u3.all[count])) & | |
802 | + ntohs(mask->src.u3.all[count])) | |
803 | + return 0; | |
804 | + } | |
805 | + | |
806 | + for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++){ | |
807 | + if ((ntohs(t->dst.u3.all[count]) ^ | |
808 | + ntohs(tuple->dst.u3.all[count])) & | |
809 | + ntohs(mask->dst.u3.all[count])) | |
810 | + return 0; | |
811 | + } | |
812 | + | |
813 | + if ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all || | |
814 | + (t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all || | |
815 | + (t->src.l3num ^ tuple->src.l3num) & mask->src.l3num || | |
816 | + (t->dst.protonum ^ tuple->dst.protonum) & mask->dst.protonum) | |
817 | + return 0; | |
818 | + | |
819 | + return 1; | |
820 | +} | |
821 | + | |
822 | +#endif /* _NF_CONNTRACK_TUPLE_H */ | |
ae95cca4 PS |
823 | diff -uNr include.orig/linux/netfilter/nfnetlink.h include/linux/netfilter/nfnetlink.h |
824 | --- include.orig/linux/netfilter/nfnetlink.h 1970-01-01 01:00:00.000000000 +0100 | |
825 | +++ include/linux/netfilter/nfnetlink.h 2005-05-06 22:08:24.000000000 +0200 | |
826 | @@ -0,0 +1,61 @@ | |
827 | +#ifndef _NFNETLINK_H | |
828 | +#define _NFNETLINK_H | |
829 | +#include <linux/types.h> | |
830 | + | |
831 | +/* Generic structure for encapsulation optional netfilter information. | |
832 | + * It is reminiscent of sockaddr, but with sa_family replaced | |
833 | + * with attribute type. | |
834 | + * ! This should someday be put somewhere generic as now rtnetlink and | |
835 | + * ! nfnetlink use the same attributes methods. - J. Schulist. | |
836 | + */ | |
837 | + | |
838 | +struct nfattr | |
839 | +{ | |
840 | + unsigned short nfa_len; | |
841 | + unsigned short nfa_type; | |
842 | +}; | |
843 | + | |
844 | +#define NFA_ALIGNTO 4 | |
845 | +#define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) | |
846 | +#define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) \ | |
847 | + && (nfa)->nfa_len <= (len)) | |
848 | +#define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), \ | |
849 | + (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) | |
850 | +#define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) | |
851 | +#define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) | |
852 | +#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) | |
853 | +#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) | |
854 | + | |
855 | +/* General form of address family dependent message. | |
856 | + */ | |
857 | +struct nfgenmsg { | |
858 | + unsigned char nfgen_family; | |
859 | +}; | |
860 | + | |
861 | +#define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) \ | |
862 | + + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) | |
863 | +#define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) | |
864 | + | |
865 | + | |
866 | +#ifndef NETLINK_NETFILTER | |
867 | +#define NETLINK_NETFILTER 10 | |
868 | +#endif | |
869 | + | |
870 | +/* netfilter netlink message types are split in two pieces: | |
871 | + * 8 bit subsystem, 8bit operation. | |
872 | + */ | |
873 | + | |
874 | +#define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8) | |
875 | +#define NFNL_MSG_TYPE(x) (x & 0x00ff) | |
876 | + | |
877 | +enum nfnl_subsys_id { | |
878 | + NFNL_SUBSYS_NONE = 0, | |
879 | + NFNL_SUBSYS_CTNETLINK, | |
880 | + NFNL_SUBSYS_CTNETLINK_EXP, | |
881 | + NFNL_SUBSYS_IPTNETLINK, | |
882 | + NFNL_SUBSYS_QUEUE, | |
883 | + NFNL_SUBSYS_ULOG, | |
884 | + NFNL_SUBSYS_COUNT, | |
885 | +}; | |
886 | + | |
887 | +#endif /* _NFNETLINK_H */ | |
888 | diff -uNr include.orig/linux/netfilter_ipv4/ip_conntrack_amanda.h include/linux/netfilter_ipv4/ip_conntrack_amanda.h | |
889 | --- include.orig/linux/netfilter_ipv4/ip_conntrack_amanda.h 2005-03-13 21:53:55.000000000 +0100 | |
890 | +++ include/linux/netfilter_ipv4/ip_conntrack_amanda.h 2005-05-06 22:11:02.000000000 +0200 | |
891 | @@ -2,10 +2,4 @@ | |
892 | #define _IP_CONNTRACK_AMANDA_H | |
893 | /* AMANDA tracking. */ | |
894 | ||
895 | -struct ip_conntrack_expect; | |
896 | -extern unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb, | |
897 | - enum ip_conntrack_info ctinfo, | |
898 | - unsigned int matchoff, | |
899 | - unsigned int matchlen, | |
900 | - struct ip_conntrack_expect *exp); | |
901 | #endif /* _IP_CONNTRACK_AMANDA_H */ | |
902 | diff -uNr include.orig/linux/netfilter_ipv4/ip_conntrack_core.h include/linux/netfilter_ipv4/ip_conntrack_core.h | |
903 | --- include.orig/linux/netfilter_ipv4/ip_conntrack_core.h 2005-03-13 21:53:55.000000000 +0100 | |
904 | +++ include/linux/netfilter_ipv4/ip_conntrack_core.h 2005-05-06 22:20:05.000000000 +0200 | |
905 | @@ -1,7 +1,6 @@ | |
906 | #ifndef _IP_CONNTRACK_CORE_H | |
907 | #define _IP_CONNTRACK_CORE_H | |
908 | #include <linux/netfilter.h> | |
909 | -#include <linux/netfilter_ipv4/lockhelp.h> | |
910 | ||
911 | /* This header is used to share core functionality between the | |
912 | standalone connection tracking module, and the compatibility layer's use | |
913 | @@ -39,10 +38,14 @@ | |
914 | /* Confirm a connection: returns NF_DROP if packet must be dropped. */ | |
915 | static inline int ip_conntrack_confirm(struct sk_buff **pskb) | |
916 | { | |
917 | + int ret = NF_ACCEPT; | |
918 | + | |
919 | if ((*pskb)->nfct | |
920 | && !is_confirmed((struct ip_conntrack *)(*pskb)->nfct)) | |
921 | - return __ip_conntrack_confirm(pskb); | |
922 | - return NF_ACCEPT; | |
923 | + ret = __ip_conntrack_confirm(pskb); | |
924 | + ip_conntrack_deliver_cached_events(*pskb); | |
925 | + | |
926 | + return ret; | |
927 | } | |
928 | ||
929 | extern struct list_head *ip_conntrack_hash; | |
930 | diff -uNr include.orig/linux/netfilter_ipv4/ip_conntrack_ftp.h include/linux/netfilter_ipv4/ip_conntrack_ftp.h | |
931 | --- include.orig/linux/netfilter_ipv4/ip_conntrack_ftp.h 2005-03-26 19:58:02.000000000 +0100 | |
932 | +++ include/linux/netfilter_ipv4/ip_conntrack_ftp.h 2005-05-06 22:11:20.000000000 +0200 | |
933 | @@ -2,8 +2,6 @@ | |
934 | #define _IP_CONNTRACK_FTP_H | |
935 | /* FTP tracking. */ | |
936 | ||
937 | -#include <asm/types.h> | |
938 | - | |
939 | enum ip_ct_ftp_type | |
940 | { | |
941 | /* PORT command from client */ | |
942 | @@ -25,15 +23,4 @@ | |
943 | int seq_aft_nl_num[IP_CT_DIR_MAX]; | |
944 | }; | |
945 | ||
946 | -struct ip_conntrack_expect; | |
947 | - | |
948 | -/* For NAT to hook in when we find a packet which describes what other | |
949 | - * connection we should expect. */ | |
950 | -extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb, | |
951 | - enum ip_conntrack_info ctinfo, | |
952 | - enum ip_ct_ftp_type type, | |
953 | - unsigned int matchoff, | |
954 | - unsigned int matchlen, | |
955 | - struct ip_conntrack_expect *exp, | |
956 | - __u32 *seq); | |
957 | #endif /* _IP_CONNTRACK_FTP_H */ | |
958 | diff -uNr include.orig/linux/netfilter_ipv4/ip_conntrack.h include/linux/netfilter_ipv4/ip_conntrack.h | |
959 | --- include.orig/linux/netfilter_ipv4/ip_conntrack.h 2005-03-13 21:53:55.000000000 +0100 | |
960 | +++ include/linux/netfilter_ipv4/ip_conntrack.h 2005-05-06 23:16:27.000000000 +0200 | |
961 | @@ -65,6 +65,100 @@ | |
962 | ||
963 | /* Both together */ | |
964 | IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), | |
965 | + | |
966 | + /* Connection is destroyed (removed from lists), can not be unset. */ | |
967 | + IPS_DESTROYED_BIT = 9, | |
968 | + IPS_DESTROYED = (1 << IPS_DESTROYED_BIT), | |
969 | +}; | |
970 | + | |
971 | +/* Connection tracking event bits */ | |
972 | +enum ip_conntrack_events | |
973 | +{ | |
974 | + /* New conntrack */ | |
975 | + IPCT_NEW_BIT = 0, | |
976 | + IPCT_NEW = (1 << IPCT_NEW_BIT), | |
977 | + | |
978 | + /* Expected connection */ | |
979 | + IPCT_RELATED_BIT = 1, | |
980 | + IPCT_RELATED = (1 << IPCT_RELATED_BIT), | |
981 | + | |
982 | + /* Destroyed conntrack */ | |
983 | + IPCT_DESTROY_BIT = 2, | |
984 | + IPCT_DESTROY = (1 << IPCT_DESTROY_BIT), | |
985 | + | |
986 | + /* Timer has been refreshed */ | |
987 | + IPCT_REFRESH_BIT = 3, | |
988 | + IPCT_REFRESH = (1 << IPCT_REFRESH_BIT), | |
989 | + | |
990 | + /* Status has changed */ | |
991 | + IPCT_STATUS_BIT = 4, | |
992 | + IPCT_STATUS = (1 << IPCT_STATUS_BIT), | |
993 | + | |
994 | + /* Update of protocol info */ | |
995 | + IPCT_PROTOINFO_BIT = 5, | |
996 | + IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT), | |
997 | + | |
998 | + /* Volatile protocol info */ | |
999 | + IPCT_PROTOINFO_VOLATILE_BIT = 6, | |
1000 | + IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT), | |
1001 | + | |
1002 | + /* New helper for conntrack */ | |
1003 | + IPCT_HELPER_BIT = 7, | |
1004 | + IPCT_HELPER = (1 << IPCT_HELPER_BIT), | |
1005 | + | |
1006 | + /* Update of helper info */ | |
1007 | + IPCT_HELPINFO_BIT = 8, | |
1008 | + IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT), | |
1009 | + | |
1010 | + /* Volatile helper info */ | |
1011 | + IPCT_HELPINFO_VOLATILE_BIT = 9, | |
1012 | + IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT), | |
1013 | + | |
1014 | + /* NAT info */ | |
1015 | + IPCT_NATINFO_BIT = 10, | |
1016 | + IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), | |
1017 | +}; | |
1018 | + | |
1019 | +enum ip_conntrack_expect_events { | |
1020 | + IPEXP_NEW_BIT = 0, | |
1021 | + IPEXP_NEW = (1 << IPEXP_NEW_BIT), | |
1022 | +}; | |
1023 | + | |
1024 | +struct ip_conntrack_counter | |
1025 | +{ | |
1026 | + u_int64_t packets; | |
1027 | + u_int64_t bytes; | |
1028 | +}; | |
1029 | + | |
1030 | +#include <linux/netfilter_ipv4/ip_conntrack_tuple.h> | |
1031 | +#include <linux/netfilter_ipv4/ip_conntrack_tcp.h> | |
1032 | +#include <linux/netfilter_ipv4/ip_conntrack_icmp.h> | |
1033 | +#include <linux/netfilter_ipv4/ip_conntrack_sctp.h> | |
1034 | + | |
1035 | +/* per conntrack: protocol private data */ | |
1036 | +union ip_conntrack_proto { | |
1037 | + /* insert conntrack proto private data here */ | |
1038 | + struct ip_ct_sctp sctp; | |
1039 | + struct ip_ct_tcp tcp; | |
1040 | + struct ip_ct_icmp icmp; | |
1041 | +}; | |
1042 | + | |
1043 | +union ip_conntrack_expect_proto { | |
1044 | + /* insert expect proto private data here */ | |
1045 | +}; | |
1046 | + | |
1047 | +/* Add protocol helper include file here */ | |
1048 | +#include <linux/netfilter_ipv4/ip_conntrack_mms.h> | |
1049 | +#include <linux/netfilter_ipv4/ip_conntrack_h323.h> | |
1050 | +#include <linux/netfilter_ipv4/ip_conntrack_amanda.h> | |
1051 | +#include <linux/netfilter_ipv4/ip_conntrack_ftp.h> | |
1052 | +#include <linux/netfilter_ipv4/ip_conntrack_irc.h> | |
1053 | + | |
1054 | +/* per conntrack: application helper private data */ | |
1055 | +union ip_conntrack_help { | |
1056 | + /* insert conntrack helper private data (master) here */ | |
1057 | + struct ip_ct_ftp_master ct_ftp_info; | |
1058 | + struct ip_ct_irc_master ct_irc_info; | |
1059 | }; | |
1060 | ||
1061 | #endif /* _IP_CONNTRACK_H */ | |
1062 | diff -uNr include.orig/linux/netfilter_ipv4/ip_conntrack_h323.h include/linux/netfilter_ipv4/ip_conntrack_h323.h | |
1063 | --- include.orig/linux/netfilter_ipv4/ip_conntrack_h323.h 1970-01-01 01:00:00.000000000 +0100 | |
1064 | +++ include/linux/netfilter_ipv4/ip_conntrack_h323.h 2005-05-06 22:11:32.000000000 +0200 | |
1065 | @@ -0,0 +1,5 @@ | |
1066 | +#ifndef _IP_CONNTRACK_H323_H | |
1067 | +#define _IP_CONNTRACK_H323_H | |
1068 | +/* H.323 connection tracking. */ | |
1069 | + | |
1070 | +#endif /* _IP_CONNTRACK_H323_H */ | |
1071 | diff -uNr include.orig/linux/netfilter_ipv4/ip_conntrack_helper.h include/linux/netfilter_ipv4/ip_conntrack_helper.h | |
1072 | --- include.orig/linux/netfilter_ipv4/ip_conntrack_helper.h 2005-03-13 21:53:55.000000000 +0100 | |
1073 | +++ include/linux/netfilter_ipv4/ip_conntrack_helper.h 2005-05-06 09:24:35.000000000 +0200 | |
1074 | @@ -9,6 +9,8 @@ | |
1075 | { | |
1076 | struct list_head list; /* Internal use. */ | |
1077 | ||
1078 | + spinlock_t *lock; /* protect private info and buffer */ | |
1079 | + | |
1080 | const char *name; /* name of the module */ | |
1081 | struct module *me; /* pointer to self */ | |
1082 | unsigned int max_expected; /* Maximum number of concurrent | |
1083 | @@ -24,6 +26,8 @@ | |
1084 | int (*help)(struct sk_buff **pskb, | |
1085 | struct ip_conntrack *ct, | |
1086 | enum ip_conntrack_info conntrackinfo); | |
1087 | + | |
1088 | + void (*change_help)(struct ip_conntrack *, union ip_conntrack_help *); | |
1089 | }; | |
1090 | ||
1091 | extern int ip_conntrack_helper_register(struct ip_conntrack_helper *); | |
1092 | @@ -38,4 +42,7 @@ | |
1093 | extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp); | |
1094 | extern void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp); | |
1095 | ||
1096 | +extern void ip_ct_generic_change_help(struct ip_conntrack *ct, | |
1097 | + union ip_conntrack_help *h); | |
1098 | + | |
1099 | #endif /*_IP_CONNTRACK_HELPER_H*/ | |
1100 | diff -uNr include.orig/linux/netfilter_ipv4/ip_conntrack_mms.h include/linux/netfilter_ipv4/ip_conntrack_mms.h | |
1101 | --- include.orig/linux/netfilter_ipv4/ip_conntrack_mms.h 1970-01-01 01:00:00.000000000 +0100 | |
1102 | +++ include/linux/netfilter_ipv4/ip_conntrack_mms.h 2005-05-06 22:12:08.000000000 +0200 | |
1103 | @@ -0,0 +1,5 @@ | |
1104 | +#ifndef _IP_CONNTRACK_MMS_H | |
1105 | +#define _IP_CONNTRACK_MMS_H | |
1106 | +/* MMS tracking. */ | |
1107 | + | |
1108 | +#endif /* _IP_CONNTRACK_MMS_H */ | |
1109 | diff -uNr include.orig/linux/netfilter_ipv4/ip_conntrack_netlink.h include/linux/netfilter_ipv4/ip_conntrack_netlink.h | |
1110 | --- include.orig/linux/netfilter_ipv4/ip_conntrack_netlink.h 1970-01-01 01:00:00.000000000 +0100 | |
1111 | +++ include/linux/netfilter_ipv4/ip_conntrack_netlink.h 2005-05-06 09:24:35.000000000 +0200 | |
1112 | @@ -0,0 +1,113 @@ | |
1113 | +#ifndef _NFNETLINK_CONNTRACK_H | |
1114 | +#define _NFNETLINK_CONNTRACK_H | |
1115 | +#include <linux/netfilter/nfnetlink.h> | |
1116 | +#include <linux/netfilter_ipv4/ip_conntrack.h> | |
1117 | + | |
1118 | +/* CTNETLINK for ip_conntrack */ | |
1119 | + | |
1120 | +/* TODO: Add more message types: | |
1121 | + * | |
1122 | + * o IPCTNL_MSG_UPDCONNTRACK, update conntracks | |
1123 | + */ | |
1124 | +enum cntl_msg_types { | |
1125 | + IPCTNL_MSG_CT_NEW, | |
1126 | + IPCTNL_MSG_CT_GET, | |
1127 | + IPCTNL_MSG_CT_DELETE, | |
1128 | + IPCTNL_MSG_CT_GET_CTRZERO, | |
1129 | + IPCTNL_MSG_CT_FLUSH, | |
1130 | + | |
1131 | + IPCTNL_MSG_EXP_NEW, | |
1132 | + IPCTNL_MSG_EXP_GET, | |
1133 | + IPCTNL_MSG_EXP_DELETE, | |
1134 | + | |
1135 | + IPCTNL_MSG_CONFIG, | |
1136 | + IPCTNL_MSG_COUNT, | |
1137 | +}; | |
1138 | + | |
1139 | +enum ctnl_dump_mask { | |
1140 | + DUMP_TUPLE_BIT = 0, | |
1141 | + DUMP_TUPLE = (1 << DUMP_TUPLE_BIT), | |
1142 | + | |
1143 | + DUMP_STATUS_BIT = 1, | |
1144 | + DUMP_STATUS = (1 << DUMP_STATUS_BIT), | |
1145 | + | |
1146 | + DUMP_TIMEOUT_BIT = 2, | |
1147 | + DUMP_TIMEOUT = (1 << DUMP_TIMEOUT_BIT), | |
1148 | + | |
1149 | + DUMP_PROTOINFO_BIT = 3, | |
1150 | + DUMP_PROTOINFO = (1 << DUMP_PROTOINFO_BIT), | |
1151 | + | |
1152 | + DUMP_HELPINFO_BIT = 4, | |
1153 | + DUMP_HELPINFO = (1 << DUMP_HELPINFO_BIT), | |
1154 | + | |
1155 | + DUMP_COUNTERS_BIT = 5, | |
1156 | + DUMP_COUNTERS = (1 << DUMP_COUNTERS_BIT), | |
1157 | + | |
1158 | + DUMP_MARK_BIT = 6, | |
1159 | + DUMP_MARK = (1 << DUMP_MARK_BIT), | |
1160 | +}; | |
1161 | + | |
1162 | +/* ctnetlink attribute types. | |
1163 | + */ | |
1164 | + | |
1165 | +enum ctattr_type_t | |
1166 | +{ | |
1167 | + CTA_UNSPEC, /* [none] I don't know (unspecified). */ | |
1168 | + CTA_ORIG, /* [ip_conntrack_tuple] Original tuple. */ | |
1169 | + CTA_RPLY, /* [ip_conntrack_tuple] Reply tuple. */ | |
1170 | + CTA_STATUS, /* [unsigned long] Status of connection. */ | |
1171 | + CTA_PROTOINFO, /* [cta_proto] Protocol specific ct information. */ | |
1172 | + CTA_HELPINFO, /* [cta_help] Helper specific information. */ | |
1173 | + CTA_TIMEOUT, /* [unsigned long] timer */ | |
1174 | + CTA_MARK, /* [unsigned long] mark .*/ | |
1175 | + CTA_COUNTERS, /* [cta_counters] packet/byte counters */ | |
1176 | + CTA_DUMPMASK, /* [unsigned int] mask for table dumping */ | |
1177 | + CTA_EVENTMASK, /* [unsigned int] mask for event notification */ | |
1178 | + | |
1179 | + CTA_EXP_TUPLE, /* [ip_conntrack_tuple] Expected tuple */ | |
1180 | + CTA_EXP_MASK, /* [ip_conntrack_tuple] Mask for EXP_TUPLE */ | |
1181 | + CTA_EXP_SEQNO, /* [u_int32_t] sequence number */ | |
1182 | + CTA_EXP_PROTO, /* [cta_exp_proto] */ | |
1183 | + CTA_EXP_TIMEOUT,/* [unsigned long] timer */ | |
1184 | + | |
1185 | + CTA_MAX = CTA_EXP_TIMEOUT | |
1186 | +}; | |
1187 | + | |
1188 | +/* Attribute specific data structures. | |
1189 | + */ | |
1190 | + | |
1191 | +struct cta_proto { | |
1192 | + unsigned char num_proto; /* Protocol number IPPROTO_X */ | |
1193 | + union ip_conntrack_proto proto; | |
1194 | +}; | |
1195 | + | |
1196 | +#define CTA_HELP_MAXNAMESZ 31 | |
1197 | + | |
1198 | +struct cta_help { | |
1199 | + char name[CTA_HELP_MAXNAMESZ]; /* name of conntrack helper */ | |
1200 | + union ip_conntrack_help help; | |
1201 | +}; | |
1202 | + | |
1203 | +struct cta_exp_proto { | |
1204 | + union ip_conntrack_expect_proto proto; | |
1205 | +}; | |
1206 | + | |
1207 | +struct cta_counters { | |
1208 | + struct ip_conntrack_counter orig; | |
1209 | + struct ip_conntrack_counter reply; | |
1210 | +}; | |
1211 | + | |
1212 | +/* ctnetlink multicast groups: reports any change of ctinfo, | |
1213 | + * ctstatus, or protocol state change. | |
1214 | + */ | |
1215 | +#define NFGRP_IPV4_CT_TCP 0x01 | |
1216 | +#define NFGRP_IPV4_CT_UDP 0x02 | |
1217 | +#define NFGRP_IPV4_CT_ICMP 0x04 | |
1218 | +#define NFGRP_IPV4_CT_OTHER 0x08 | |
1219 | + | |
1220 | +#define NFGRP_IPV6_CT_TCP 0x10 | |
1221 | +#define NFGRP_IPV6_CT_UDP 0x20 | |
1222 | +#define NFGRP_IPV6_CT_ICMP 0x40 | |
1223 | +#define NFGRP_IPV6_CT_OTHER 0x80 | |
1224 | + | |
1225 | +#endif /* _NFNETLINK_CONNTRACK_H */ | |
1226 | diff -uNr include.orig/linux/netfilter_ipv4/ip_conntrack_protocol.h include/linux/netfilter_ipv4/ip_conntrack_protocol.h | |
1227 | --- include.orig/linux/netfilter_ipv4/ip_conntrack_protocol.h 2005-03-13 21:53:55.000000000 +0100 | |
1228 | +++ include/linux/netfilter_ipv4/ip_conntrack_protocol.h 2005-05-06 09:24:35.000000000 +0200 | |
1229 | @@ -10,6 +10,8 @@ | |
1230 | /* Protocol number. */ | |
1231 | u_int8_t proto; | |
1232 | ||
1233 | + rwlock_t *lock; | |
1234 | + | |
1235 | /* Protocol name */ | |
1236 | const char *name; | |
1237 | ||
1238 | @@ -34,7 +36,7 @@ | |
1239 | ||
1240 | /* Returns verdict for packet, or -1 for invalid. */ | |
1241 | int (*packet)(struct ip_conntrack *conntrack, | |
1242 | - const struct sk_buff *skb, | |
1243 | + struct sk_buff *skb, | |
1244 | enum ip_conntrack_info ctinfo); | |
1245 | ||
1246 | /* Called when a new connection for this protocol found; | |
1247 | @@ -47,6 +49,17 @@ | |
1248 | int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, | |
1249 | unsigned int hooknum); | |
1250 | ||
1251 | + /* check if tuples are valid for a new connection */ | |
1252 | + int (*change_check_tuples)(struct ip_conntrack_tuple *orig, | |
1253 | + struct ip_conntrack_tuple *reply); | |
1254 | + | |
1255 | + /* check protocol data is valid */ | |
1256 | + int (*change_check_proto)(union ip_conntrack_proto *p); | |
1257 | + | |
1258 | + /* change protocol info on behalf of ctnetlink */ | |
1259 | + void (*change_proto)(struct ip_conntrack *ct, | |
1260 | + union ip_conntrack_proto *p); | |
1261 | + | |
1262 | /* Module (if any) which this is connected to. */ | |
1263 | struct module *me; | |
1264 | }; | |
1265 | @@ -57,6 +70,8 @@ | |
1266 | /* Protocol registration. */ | |
1267 | extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto); | |
1268 | extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto); | |
1269 | +extern void ip_ct_generic_change_proto(struct ip_conntrack *conntrack, | |
1270 | + union ip_conntrack_proto *p); | |
1271 | ||
1272 | static inline struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol) | |
1273 | { | |
1274 | diff -uNr include.orig/linux/netfilter_ipv4/ip_logging.h include/linux/netfilter_ipv4/ip_logging.h | |
1275 | --- include.orig/linux/netfilter_ipv4/ip_logging.h 1970-01-01 01:00:00.000000000 +0100 | |
1276 | +++ include/linux/netfilter_ipv4/ip_logging.h 2005-05-06 22:12:26.000000000 +0200 | |
e0dfec11 PS |
1277 | @@ -0,0 +1,5 @@ |
1278 | +/* IPv4 macros for the internal logging interface. */ | |
1279 | +#ifndef __IP_LOGGING_H | |
1280 | +#define __IP_LOGGING_H | |
1281 | + | |
1282 | +#endif /*__IP_LOGGING_H*/ | |
ae95cca4 PS |
1283 | diff -uNr include.orig/linux/netfilter_ipv4/ip_nat.h include/linux/netfilter_ipv4/ip_nat.h |
1284 | --- include.orig/linux/netfilter_ipv4/ip_nat.h 2005-03-25 01:06:43.000000000 +0100 | |
1285 | +++ include/linux/netfilter_ipv4/ip_nat.h 2005-05-06 22:13:06.000000000 +0200 | |
1286 | @@ -39,33 +39,15 @@ | |
014436e1 | 1287 | union ip_conntrack_manip_proto min, max; |
0fc89030 PS |
1288 | }; |
1289 | ||
014436e1 | 1290 | -/* A range consists of an array of 1 or more ip_nat_range */ |
014436e1 | 1291 | +/* For backwards compat: don't use in modern code. */ |
85095ce0 | 1292 | struct ip_nat_multi_range_compat |
014436e1 PS |
1293 | { |
1294 | - unsigned int rangesize; | |
1295 | + unsigned int rangesize; /* Must be 1. */ | |
0fc89030 | 1296 | |
014436e1 PS |
1297 | /* hangs off end. */ |
1298 | struct ip_nat_range range[1]; | |
1299 | }; | |
1300 | ||
1301 | -/* Worst case: local-out manip + 1 post-routing, and reverse dirn. */ | |
1302 | -#define IP_NAT_MAX_MANIPS (2*3) | |
1303 | - | |
1304 | -struct ip_nat_info_manip | |
1305 | -{ | |
1306 | - /* The direction. */ | |
1307 | - u_int8_t direction; | |
1308 | - | |
1309 | - /* Which hook the manipulation happens on. */ | |
1310 | - u_int8_t hooknum; | |
1311 | - | |
1312 | - /* The manipulation type. */ | |
1313 | - u_int8_t maniptype; | |
1314 | - | |
1315 | - /* Manipulations to occur at each conntrack in this dirn. */ | |
1316 | - struct ip_conntrack_manip manip; | |
1317 | -}; | |
1318 | - | |
85095ce0 | 1319 | #define ip_nat_multi_range ip_nat_multi_range_compat |
ae95cca4 | 1320 | |
014436e1 | 1321 | #endif |
ae95cca4 PS |
1322 | diff -uNr include.orig/linux/netfilter_ipv4/ip_queue.h include/linux/netfilter_ipv4/ip_queue.h |
1323 | --- include.orig/linux/netfilter_ipv4/ip_queue.h 2004-10-31 20:56:03.000000000 +0100 | |
1324 | +++ include/linux/netfilter_ipv4/ip_queue.h 2005-05-06 22:13:35.000000000 +0200 | |
1325 | @@ -39,10 +39,20 @@ | |
1326 | unsigned char payload[0]; /* Optional replacement packet */ | |
1327 | } ipq_verdict_msg_t; | |
1328 | ||
1329 | +typedef struct ipq_vwmark_msg { | |
1330 | + unsigned int value; /* Verdict to hand to netfilter */ | |
1331 | + unsigned long id; /* Packet ID for this verdict */ | |
1332 | + size_t data_len; /* Length of replacement data */ | |
1333 | + unsigned char payload[0]; /* Optional replacement packet */ | |
1334 | + unsigned long nfmark; /* Mark for the Packet */ | |
1335 | +} ipq_vwmark_msg_t; | |
1336 | + | |
1337 | + | |
1338 | typedef struct ipq_peer_msg { | |
1339 | union { | |
1340 | ipq_verdict_msg_t verdict; | |
1341 | ipq_mode_msg_t mode; | |
1342 | + ipq_vwmark_msg_t vwmark; | |
1343 | } msg; | |
1344 | } ipq_peer_msg_t; | |
1345 | ||
1346 | @@ -59,6 +69,7 @@ | |
1347 | #define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */ | |
1348 | #define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */ | |
1349 | #define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */ | |
1350 | -#define IPQM_MAX (IPQM_BASE + 4) | |
1351 | +#define IPQM_VWMARK (IPQM_BASE + 4) /* Verdict and mark from peer */ | |
1352 | +#define IPQM_MAX (IPQM_BASE + 5) | |
1353 | ||
1354 | #endif /*_IP_QUEUE_H*/ | |
1355 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set.h include/linux/netfilter_ipv4/ip_set.h | |
1356 | --- include.orig/linux/netfilter_ipv4/ip_set.h 1970-01-01 01:00:00.000000000 +0100 | |
1357 | +++ include/linux/netfilter_ipv4/ip_set.h 2005-05-06 22:13:48.000000000 +0200 | |
014436e1 PS |
1358 | @@ -0,0 +1,293 @@ |
1359 | +#ifndef _IP_SET_H | |
1360 | +#define _IP_SET_H | |
1361 | + | |
1362 | +/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | |
1363 | + * Patrick Schaaf <bof@bof.de> | |
1364 | + * Martin Josefsson <gandalf@wlug.westbo.se> | |
1365 | + * Copyright (C) 2003-2004 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | |
1366 | + * | |
1367 | + * This program is free software; you can redistribute it and/or modify | |
1368 | + * it under the terms of the GNU General Public License version 2 as | |
1369 | + * published by the Free Software Foundation. | |
1370 | + */ | |
1371 | + | |
1372 | +/* | |
1373 | + * A sockopt of such quality has hardly ever been seen before on the open | |
1374 | + * market! This little beauty, hardly ever used: above 64, so it's | |
1375 | + * traditionally used for firewalling, not touched (even once!) by the | |
1376 | + * 2.0, 2.2 and 2.4 kernels! | |
1377 | + * | |
1378 | + * Comes with its own certificate of authenticity, valid anywhere in the | |
1379 | + * Free world! | |
1380 | + * | |
1381 | + * Rusty, 19.4.2000 | |
1382 | + */ | |
1383 | +#define SO_IP_SET 83 | |
1384 | + | |
1385 | +/* | |
1386 | + * Heavily modify by Joakim Axelsson 08.03.2002 | |
1387 | + * - Made it more modulebased | |
1388 | + * | |
1389 | + * Additional heavy modifications by Jozsef Kadlecsik 22.02.2004 | |
1390 | + * - bindings added | |
1391 | + * - in order to "deal with" backward compatibility, renamed to ipset | |
1392 | + */ | |
1393 | + | |
1394 | +/* | |
1395 | + * Used so that the kernel module and ipset-binary can match their versions | |
1396 | + */ | |
1397 | +#define IP_SET_PROTOCOL_VERSION 2 | |
1398 | + | |
1399 | +#define IP_SET_MAXNAMELEN 32 /* set names and set typenames */ | |
1400 | + | |
1401 | +/* Lets work with our own typedef for representing an IP address. | |
1402 | + * We hope to make the code more portable, possibly to IPv6... | |
1403 | + * | |
1404 | + * The representation works in HOST byte order, because most set types | |
1405 | + * will perform arithmetic operations and compare operations. | |
1406 | + * | |
1407 | + * For now the type is an uint32_t. | |
1408 | + * | |
1409 | + * Make sure to ONLY use the functions when translating and parsing | |
1410 | + * in order to keep the host byte order and make it more portable: | |
1411 | + * parse_ip() | |
1412 | + * parse_mask() | |
1413 | + * parse_ipandmask() | |
1414 | + * ip_tostring() | |
1415 | + * (Joakim: where are they???) | |
1416 | + */ | |
1417 | + | |
1418 | +typedef uint32_t ip_set_ip_t; | |
1419 | + | |
1420 | +/* Sets are identified by an id in kernel space. Tweak with ip_set_id_t | |
1421 | + * and IP_SET_INVALID_ID if you want to increase the max number of sets. | |
1422 | + */ | |
1423 | +typedef uint16_t ip_set_id_t; | |
1424 | + | |
1425 | +#define IP_SET_INVALID_ID 65535 | |
1426 | + | |
1427 | +/* How deep we follow bindings */ | |
1428 | +#define IP_SET_MAX_BINDINGS 6 | |
1429 | + | |
1430 | +/* | |
1431 | + * Option flags for kernel operations (ipt_set_info) | |
1432 | + */ | |
1433 | +#define IPSET_SRC 0x01 /* Source match/add */ | |
1434 | +#define IPSET_DST 0x02 /* Destination match/add */ | |
1435 | +#define IPSET_MATCH_INV 0x04 /* Inverse matching */ | |
1436 | + | |
1437 | +/* | |
1438 | + * Set types (flavours) | |
1439 | + */ | |
1440 | +#define IPSET_TYPE_IP 0 /* IP address type of set */ | |
1441 | +#define IPSET_TYPE_PORT 1 /* Port type of set */ | |
1442 | + | |
1443 | +/* Reserved keywords */ | |
1444 | +#define IPSET_TOKEN_DEFAULT ":default:" | |
1445 | +#define IPSET_TOKEN_ALL ":all:" | |
1446 | + | |
1447 | +/* SO_IP_SET operation constants, and their request struct types. | |
1448 | + * | |
1449 | + * Operation ids: | |
1450 | + * 0-99: commands with version checking | |
1451 | + * 100-199: add/del/test/bind/unbind | |
1452 | + * 200-299: list, save, restore | |
1453 | + */ | |
1454 | + | |
1455 | +/* Single shot operations: | |
1456 | + * version, create, destroy, flush, rename and swap | |
1457 | + * | |
1458 | + * Sets are identified by name. | |
1459 | + */ | |
1460 | + | |
1461 | +#define IP_SET_REQ_STD \ | |
1462 | + unsigned op; \ | |
1463 | + unsigned version; \ | |
1464 | + char name[IP_SET_MAXNAMELEN] | |
1465 | + | |
1466 | +#define IP_SET_OP_CREATE 0x00000001 /* Create a new (empty) set */ | |
1467 | +struct ip_set_req_create { | |
1468 | + IP_SET_REQ_STD; | |
1469 | + char typename[IP_SET_MAXNAMELEN]; | |
1470 | +}; | |
1471 | + | |
1472 | +#define IP_SET_OP_DESTROY 0x00000002 /* Remove a (empty) set */ | |
1473 | +struct ip_set_req_std { | |
1474 | + IP_SET_REQ_STD; | |
1475 | +}; | |
1476 | + | |
1477 | +#define IP_SET_OP_FLUSH 0x00000003 /* Remove all IPs in a set */ | |
1478 | +/* Uses ip_set_req_std */ | |
1479 | + | |
1480 | +#define IP_SET_OP_RENAME 0x00000004 /* Rename a set */ | |
1481 | +/* Uses ip_set_req_create */ | |
1482 | + | |
1483 | +#define IP_SET_OP_SWAP 0x00000005 /* Swap two sets */ | |
1484 | +/* Uses ip_set_req_create */ | |
1485 | + | |
1486 | +union ip_set_name_index { | |
1487 | + char name[IP_SET_MAXNAMELEN]; | |
1488 | + ip_set_id_t index; | |
1489 | +}; | |
1490 | + | |
1491 | +#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */ | |
1492 | +struct ip_set_req_get_set { | |
1493 | + unsigned op; | |
1494 | + unsigned version; | |
1495 | + union ip_set_name_index set; | |
1496 | +}; | |
1497 | + | |
1498 | +#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */ | |
1499 | +/* Uses ip_set_req_get_set */ | |
1500 | + | |
1501 | +#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ | |
1502 | +struct ip_set_req_version { | |
1503 | + unsigned op; | |
1504 | + unsigned version; | |
1505 | +}; | |
1506 | + | |
1507 | +/* Double shots operations: | |
1508 | + * add, del, test, bind and unbind. | |
1509 | + * | |
1510 | + * First we query the kernel to get the index and type of the target set, | |
1511 | + * then issue the command. Validity of IP is checked in kernel in order | |
1512 | + * to minimalize sockopt operations. | |
1513 | + */ | |
1514 | + | |
1515 | +/* Get minimal set data for add/del/test/bind/unbind IP */ | |
1516 | +#define IP_SET_OP_ADT_GET 0x00000010 /* Get set and type */ | |
1517 | +struct ip_set_req_adt_get { | |
1518 | + unsigned op; | |
1519 | + unsigned version; | |
1520 | + union ip_set_name_index set; | |
1521 | + char typename[IP_SET_MAXNAMELEN]; | |
1522 | +}; | |
1523 | + | |
1524 | +#define IP_SET_REQ_BYINDEX \ | |
1525 | + unsigned op; \ | |
1526 | + ip_set_id_t index; | |
1527 | + | |
1528 | +struct ip_set_req_adt { | |
1529 | + IP_SET_REQ_BYINDEX; | |
1530 | +}; | |
1531 | + | |
1532 | +#define IP_SET_OP_ADD_IP 0x00000101 /* Add an IP to a set */ | |
1533 | +/* Uses ip_set_req_adt, with type specific addage */ | |
1534 | + | |
1535 | +#define IP_SET_OP_DEL_IP 0x00000102 /* Remove an IP from a set */ | |
1536 | +/* Uses ip_set_req_adt, with type specific addage */ | |
1537 | + | |
1538 | +#define IP_SET_OP_TEST_IP 0x00000103 /* Test an IP in a set */ | |
1539 | +/* Uses ip_set_req_adt, with type specific addage */ | |
1540 | + | |
1541 | +#define IP_SET_OP_BIND_SET 0x00000104 /* Bind an IP to a set */ | |
1542 | +/* Uses ip_set_req_bind, with type specific addage */ | |
1543 | +struct ip_set_req_bind { | |
1544 | + IP_SET_REQ_BYINDEX; | |
1545 | + char binding[IP_SET_MAXNAMELEN]; | |
1546 | +}; | |
1547 | + | |
1548 | +#define IP_SET_OP_UNBIND_SET 0x00000105 /* Unbind an IP from a set */ | |
1549 | +/* Uses ip_set_req_bind, with type speficic addage | |
1550 | + * index = 0 means unbinding for all sets */ | |
1551 | + | |
1552 | +#define IP_SET_OP_TEST_BIND_SET 0x00000106 /* Test binding an IP to a set */ | |
1553 | +/* Uses ip_set_req_bind, with type specific addage */ | |
1554 | + | |
1555 | +/* Multiple shots operations: list, save, restore. | |
1556 | + * | |
1557 | + * - check kernel version and query the max number of sets | |
1558 | + * - get the basic information on all sets | |
1559 | + * and size required for the next step | |
1560 | + * - get actual set data: header, data, bindings | |
1561 | + */ | |
1562 | + | |
1563 | +/* Get max_sets and the index of a queried set | |
1564 | + */ | |
1565 | +#define IP_SET_OP_MAX_SETS 0x00000020 | |
1566 | +struct ip_set_req_max_sets { | |
1567 | + unsigned op; | |
1568 | + unsigned version; | |
1569 | + ip_set_id_t max_sets; /* max_sets */ | |
1570 | + ip_set_id_t sets; /* real number of sets */ | |
1571 | + union ip_set_name_index set; /* index of set if name used */ | |
1572 | +}; | |
1573 | + | |
1574 | +/* Get the id and name of the sets plus size for next step */ | |
1575 | +#define IP_SET_OP_LIST_SIZE 0x00000201 | |
1576 | +#define IP_SET_OP_SAVE_SIZE 0x00000202 | |
1577 | +struct ip_set_req_setnames { | |
1578 | + unsigned op; | |
1579 | + ip_set_id_t index; /* set to list/save */ | |
1580 | + size_t size; /* size to get setdata/bindings */ | |
1581 | + /* followed by sets number of struct ip_set_name_list */ | |
1582 | +}; | |
1583 | + | |
1584 | +struct ip_set_name_list { | |
1585 | + char name[IP_SET_MAXNAMELEN]; | |
1586 | + char typename[IP_SET_MAXNAMELEN]; | |
1587 | + ip_set_id_t index; | |
1588 | + ip_set_id_t id; | |
1589 | +}; | |
1590 | + | |
1591 | +/* The actual list operation */ | |
1592 | +#define IP_SET_OP_LIST 0x00000203 | |
1593 | +struct ip_set_req_list { | |
1594 | + IP_SET_REQ_BYINDEX; | |
1595 | + /* sets number of struct ip_set_list in reply */ | |
1596 | +}; | |
1597 | + | |
1598 | +struct ip_set_list { | |
1599 | + ip_set_id_t index; | |
1600 | + ip_set_id_t binding; | |
1601 | + u_int32_t ref; | |
1602 | + size_t header_size; /* Set header data of header_size */ | |
1603 | + size_t members_size; /* Set members data of members_size */ | |
1604 | + size_t bindings_size; /* Set bindings data of bindings_size */ | |
1605 | +}; | |
1606 | + | |
1607 | +struct ip_set_hash_list { | |
1608 | + ip_set_ip_t ip; | |
1609 | + ip_set_id_t binding; | |
1610 | +}; | |
1611 | + | |
1612 | +/* The save operation */ | |
1613 | +#define IP_SET_OP_SAVE 0x00000204 | |
1614 | +/* Uses ip_set_req_list, in the reply replaced by | |
1615 | + * sets number of struct ip_set_save plus a marker | |
1616 | + * ip_set_save followed by ip_set_hash_save structures. | |
1617 | + */ | |
1618 | +struct ip_set_save { | |
1619 | + ip_set_id_t index; | |
1620 | + ip_set_id_t binding; | |
1621 | + size_t header_size; /* Set header data of header_size */ | |
1622 | + size_t members_size; /* Set members data of members_size */ | |
1623 | +}; | |
1624 | + | |
1625 | +/* At restoring, ip == 0 means default binding for the given set: */ | |
1626 | +struct ip_set_hash_save { | |
1627 | + ip_set_ip_t ip; | |
1628 | + ip_set_id_t id; | |
1629 | + ip_set_id_t binding; | |
1630 | +}; | |
1631 | + | |
1632 | +/* The restore operation */ | |
1633 | +#define IP_SET_OP_RESTORE 0x00000205 | |
1634 | +/* Uses ip_set_req_setnames followed by ip_set_restore structures | |
1635 | + * plus a marker ip_set_restore, followed by ip_set_hash_save | |
1636 | + * structures. | |
1637 | + */ | |
1638 | +struct ip_set_restore { | |
1639 | + char name[IP_SET_MAXNAMELEN]; | |
1640 | + char typename[IP_SET_MAXNAMELEN]; | |
1641 | + ip_set_id_t index; | |
1642 | + size_t header_size; /* Create data of header_size */ | |
1643 | + size_t members_size; /* Set members data of members_size */ | |
1644 | +}; | |
1645 | + | |
1646 | +static inline int bitmap_bytes(ip_set_ip_t a, ip_set_ip_t b) | |
1647 | +{ | |
1648 | + return 4 * ((((b - a + 8) / 8) + 3) / 4); | |
1649 | +} | |
1650 | + | |
1651 | +#endif /*_IP_SET_H*/ | |
ae95cca4 PS |
1652 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set_iphash.h include/linux/netfilter_ipv4/ip_set_iphash.h |
1653 | --- include.orig/linux/netfilter_ipv4/ip_set_iphash.h 1970-01-01 01:00:00.000000000 +0100 | |
1654 | +++ include/linux/netfilter_ipv4/ip_set_iphash.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
1655 | @@ -0,0 +1,30 @@ |
1656 | +#ifndef __IP_SET_IPHASH_H | |
1657 | +#define __IP_SET_IPHASH_H | |
1658 | + | |
1659 | +#include <linux/netfilter_ipv4/ip_set.h> | |
1660 | + | |
1661 | +#define SETTYPE_NAME "iphash" | |
1662 | +#define MAX_RANGE 0x0000FFFF | |
1663 | + | |
1664 | +struct ip_set_iphash { | |
1665 | + ip_set_ip_t *members; /* the iphash proper */ | |
1666 | + uint32_t initval; /* initval for jhash_1word */ | |
1667 | + uint32_t prime; /* prime for double hashing */ | |
1668 | + uint32_t hashsize; /* hash size */ | |
1669 | + uint16_t probes; /* max number of probes */ | |
1670 | + uint16_t resize; /* resize factor in percent */ | |
1671 | + ip_set_ip_t netmask; /* netmask */ | |
1672 | +}; | |
1673 | + | |
1674 | +struct ip_set_req_iphash_create { | |
1675 | + uint32_t hashsize; | |
1676 | + uint16_t probes; | |
1677 | + uint16_t resize; | |
1678 | + ip_set_ip_t netmask; | |
1679 | +}; | |
1680 | + | |
1681 | +struct ip_set_req_iphash { | |
1682 | + ip_set_ip_t ip; | |
1683 | +}; | |
1684 | + | |
1685 | +#endif /* __IP_SET_IPHASH_H */ | |
ae95cca4 PS |
1686 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set_ipmap.h include/linux/netfilter_ipv4/ip_set_ipmap.h |
1687 | --- include.orig/linux/netfilter_ipv4/ip_set_ipmap.h 1970-01-01 01:00:00.000000000 +0100 | |
1688 | +++ include/linux/netfilter_ipv4/ip_set_ipmap.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
1689 | @@ -0,0 +1,56 @@ |
1690 | +#ifndef __IP_SET_IPMAP_H | |
1691 | +#define __IP_SET_IPMAP_H | |
1692 | + | |
1693 | +#include <linux/netfilter_ipv4/ip_set.h> | |
1694 | + | |
1695 | +#define SETTYPE_NAME "ipmap" | |
1696 | +#define MAX_RANGE 0x0000FFFF | |
1697 | + | |
1698 | +struct ip_set_ipmap { | |
1699 | + void *members; /* the ipmap proper */ | |
1700 | + ip_set_ip_t first_ip; /* host byte order, included in range */ | |
1701 | + ip_set_ip_t last_ip; /* host byte order, included in range */ | |
1702 | + ip_set_ip_t netmask; /* subnet netmask */ | |
1703 | + ip_set_ip_t sizeid; /* size of set in IPs */ | |
1704 | + u_int16_t hosts; /* number of hosts in a subnet */ | |
1705 | +}; | |
1706 | + | |
1707 | +struct ip_set_req_ipmap_create { | |
1708 | + ip_set_ip_t from; | |
1709 | + ip_set_ip_t to; | |
1710 | + ip_set_ip_t netmask; | |
1711 | +}; | |
1712 | + | |
1713 | +struct ip_set_req_ipmap { | |
1714 | + ip_set_ip_t ip; | |
1715 | +}; | |
1716 | + | |
1717 | +unsigned int | |
1718 | +mask_to_bits(ip_set_ip_t mask) | |
1719 | +{ | |
1720 | + unsigned int bits = 32; | |
1721 | + ip_set_ip_t maskaddr; | |
1722 | + | |
1723 | + if (mask == 0xFFFFFFFF) | |
1724 | + return bits; | |
1725 | + | |
1726 | + maskaddr = 0xFFFFFFFE; | |
1727 | + while (--bits >= 0 && maskaddr != mask) | |
1728 | + maskaddr <<= 1; | |
1729 | + | |
1730 | + return bits; | |
1731 | +} | |
1732 | + | |
1733 | +ip_set_ip_t | |
1734 | +range_to_mask(ip_set_ip_t from, ip_set_ip_t to, unsigned int *bits) | |
1735 | +{ | |
1736 | + ip_set_ip_t mask = 0xFFFFFFFE; | |
1737 | + | |
1738 | + *bits = 32; | |
1739 | + while (--(*bits) >= 0 && mask && (to & mask) != from) | |
1740 | + mask <<= 1; | |
1741 | + | |
1742 | + return mask; | |
1743 | +} | |
1744 | + | |
1745 | +#endif /* __IP_SET_IPMAP_H */ | |
ae95cca4 PS |
1746 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set_iptree.h include/linux/netfilter_ipv4/ip_set_iptree.h |
1747 | --- include.orig/linux/netfilter_ipv4/ip_set_iptree.h 1970-01-01 01:00:00.000000000 +0100 | |
1748 | +++ include/linux/netfilter_ipv4/ip_set_iptree.h 2005-05-06 22:14:47.000000000 +0200 | |
1749 | @@ -0,0 +1,35 @@ | |
1750 | +#ifndef __IP_SET_IPTREE_H | |
1751 | +#define __IP_SET_IPTREE_H | |
1752 | + | |
1753 | +#include <linux/netfilter_ipv4/ip_set.h> | |
1754 | + | |
1755 | +#define SETTYPE_NAME "iptree" | |
1756 | +#define MAX_RANGE 0x0000FFFF | |
1757 | + | |
1758 | +struct ip_set_iptreed { | |
1759 | + unsigned long expires[255]; /* x.x.x.ADDR */ | |
1760 | +}; | |
1761 | + | |
1762 | +struct ip_set_iptreec { | |
1763 | + struct ip_set_iptreed *tree[255]; /* x.x.ADDR.* */ | |
1764 | +}; | |
1765 | + | |
1766 | +struct ip_set_iptreeb { | |
1767 | + struct ip_set_iptreec *tree[255]; /* x.ADDR.*.* */ | |
1768 | +}; | |
1769 | + | |
1770 | +struct ip_set_iptree { | |
1771 | + unsigned int timeout; | |
1772 | + unsigned int gc_interval; | |
1773 | +}; | |
1774 | + | |
1775 | +struct ip_set_req_iptree_create { | |
1776 | + unsigned int timeout; | |
1777 | +}; | |
1778 | + | |
1779 | +struct ip_set_req_iptree { | |
1780 | + ip_set_ip_t ip; | |
1781 | + unsigned int timeout; | |
1782 | +}; | |
1783 | + | |
1784 | +#endif /* __IP_SET_IPTREE_H */ | |
1785 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set_jhash.h include/linux/netfilter_ipv4/ip_set_jhash.h | |
1786 | --- include.orig/linux/netfilter_ipv4/ip_set_jhash.h 1970-01-01 01:00:00.000000000 +0100 | |
1787 | +++ include/linux/netfilter_ipv4/ip_set_jhash.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
1788 | @@ -0,0 +1,148 @@ |
1789 | +#ifndef _LINUX_IPSET_JHASH_H | |
1790 | +#define _LINUX_IPSET_JHASH_H | |
1791 | + | |
1792 | +/* This is a copy of linux/jhash.h but the types u32/u8 are changed | |
1793 | + * to __u32/__u8 so that the header file can be included into | |
1794 | + * userspace code as well. Jozsef Kadlecsik (kadlec@blackhole.kfki.hu) | |
1795 | + */ | |
1796 | + | |
1797 | +/* jhash.h: Jenkins hash support. | |
1798 | + * | |
1799 | + * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net) | |
1800 | + * | |
1801 | + * http://burtleburtle.net/bob/hash/ | |
1802 | + * | |
1803 | + * These are the credits from Bob's sources: | |
1804 | + * | |
1805 | + * lookup2.c, by Bob Jenkins, December 1996, Public Domain. | |
1806 | + * hash(), hash2(), hash3, and mix() are externally useful functions. | |
1807 | + * Routines to test the hash are included if SELF_TEST is defined. | |
1808 | + * You can use this free for any purpose. It has no warranty. | |
1809 | + * | |
1810 | + * Copyright (C) 2003 David S. Miller (davem@redhat.com) | |
1811 | + * | |
1812 | + * I've modified Bob's hash to be useful in the Linux kernel, and | |
1813 | + * any bugs present are surely my fault. -DaveM | |
1814 | + */ | |
1815 | + | |
1816 | +/* NOTE: Arguments are modified. */ | |
1817 | +#define __jhash_mix(a, b, c) \ | |
1818 | +{ \ | |
1819 | + a -= b; a -= c; a ^= (c>>13); \ | |
1820 | + b -= c; b -= a; b ^= (a<<8); \ | |
1821 | + c -= a; c -= b; c ^= (b>>13); \ | |
1822 | + a -= b; a -= c; a ^= (c>>12); \ | |
1823 | + b -= c; b -= a; b ^= (a<<16); \ | |
1824 | + c -= a; c -= b; c ^= (b>>5); \ | |
1825 | + a -= b; a -= c; a ^= (c>>3); \ | |
1826 | + b -= c; b -= a; b ^= (a<<10); \ | |
1827 | + c -= a; c -= b; c ^= (b>>15); \ | |
1828 | +} | |
1829 | + | |
1830 | +/* The golden ration: an arbitrary value */ | |
1831 | +#define JHASH_GOLDEN_RATIO 0x9e3779b9 | |
1832 | + | |
1833 | +/* The most generic version, hashes an arbitrary sequence | |
1834 | + * of bytes. No alignment or length assumptions are made about | |
1835 | + * the input key. | |
1836 | + */ | |
1837 | +static inline __u32 jhash(void *key, __u32 length, __u32 initval) | |
1838 | +{ | |
1839 | + __u32 a, b, c, len; | |
1840 | + __u8 *k = key; | |
1841 | + | |
1842 | + len = length; | |
1843 | + a = b = JHASH_GOLDEN_RATIO; | |
1844 | + c = initval; | |
1845 | + | |
1846 | + while (len >= 12) { | |
1847 | + a += (k[0] +((__u32)k[1]<<8) +((__u32)k[2]<<16) +((__u32)k[3]<<24)); | |
1848 | + b += (k[4] +((__u32)k[5]<<8) +((__u32)k[6]<<16) +((__u32)k[7]<<24)); | |
1849 | + c += (k[8] +((__u32)k[9]<<8) +((__u32)k[10]<<16)+((__u32)k[11]<<24)); | |
1850 | + | |
1851 | + __jhash_mix(a,b,c); | |
1852 | + | |
1853 | + k += 12; | |
1854 | + len -= 12; | |
1855 | + } | |
1856 | + | |
1857 | + c += length; | |
1858 | + switch (len) { | |
1859 | + case 11: c += ((__u32)k[10]<<24); | |
1860 | + case 10: c += ((__u32)k[9]<<16); | |
1861 | + case 9 : c += ((__u32)k[8]<<8); | |
1862 | + case 8 : b += ((__u32)k[7]<<24); | |
1863 | + case 7 : b += ((__u32)k[6]<<16); | |
1864 | + case 6 : b += ((__u32)k[5]<<8); | |
1865 | + case 5 : b += k[4]; | |
1866 | + case 4 : a += ((__u32)k[3]<<24); | |
1867 | + case 3 : a += ((__u32)k[2]<<16); | |
1868 | + case 2 : a += ((__u32)k[1]<<8); | |
1869 | + case 1 : a += k[0]; | |
1870 | + }; | |
1871 | + | |
1872 | + __jhash_mix(a,b,c); | |
1873 | + | |
1874 | + return c; | |
1875 | +} | |
1876 | + | |
1877 | +/* A special optimized version that handles 1 or more of __u32s. | |
1878 | + * The length parameter here is the number of __u32s in the key. | |
1879 | + */ | |
1880 | +static inline __u32 jhash2(__u32 *k, __u32 length, __u32 initval) | |
1881 | +{ | |
1882 | + __u32 a, b, c, len; | |
1883 | + | |
1884 | + a = b = JHASH_GOLDEN_RATIO; | |
1885 | + c = initval; | |
1886 | + len = length; | |
1887 | + | |
1888 | + while (len >= 3) { | |
1889 | + a += k[0]; | |
1890 | + b += k[1]; | |
1891 | + c += k[2]; | |
1892 | + __jhash_mix(a, b, c); | |
1893 | + k += 3; len -= 3; | |
1894 | + } | |
1895 | + | |
1896 | + c += length * 4; | |
1897 | + | |
1898 | + switch (len) { | |
1899 | + case 2 : b += k[1]; | |
1900 | + case 1 : a += k[0]; | |
1901 | + }; | |
1902 | + | |
1903 | + __jhash_mix(a,b,c); | |
1904 | + | |
1905 | + return c; | |
1906 | +} | |
1907 | + | |
1908 | + | |
1909 | +/* A special ultra-optimized versions that knows they are hashing exactly | |
1910 | + * 3, 2 or 1 word(s). | |
1911 | + * | |
1912 | + * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally | |
1913 | + * done at the end is not done here. | |
1914 | + */ | |
1915 | +static inline __u32 jhash_3words(__u32 a, __u32 b, __u32 c, __u32 initval) | |
1916 | +{ | |
1917 | + a += JHASH_GOLDEN_RATIO; | |
1918 | + b += JHASH_GOLDEN_RATIO; | |
1919 | + c += initval; | |
1920 | + | |
1921 | + __jhash_mix(a, b, c); | |
1922 | + | |
1923 | + return c; | |
1924 | +} | |
1925 | + | |
1926 | +static inline __u32 jhash_2words(__u32 a, __u32 b, __u32 initval) | |
1927 | +{ | |
1928 | + return jhash_3words(a, b, 0, initval); | |
1929 | +} | |
1930 | + | |
1931 | +static inline __u32 jhash_1word(__u32 a, __u32 initval) | |
1932 | +{ | |
1933 | + return jhash_3words(a, 0, 0, initval); | |
1934 | +} | |
1935 | + | |
1936 | +#endif /* _LINUX_IPSET_JHASH_H */ | |
ae95cca4 PS |
1937 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set_macipmap.h include/linux/netfilter_ipv4/ip_set_macipmap.h |
1938 | --- include.orig/linux/netfilter_ipv4/ip_set_macipmap.h 1970-01-01 01:00:00.000000000 +0100 | |
1939 | +++ include/linux/netfilter_ipv4/ip_set_macipmap.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
1940 | @@ -0,0 +1,38 @@ |
1941 | +#ifndef __IP_SET_MACIPMAP_H | |
1942 | +#define __IP_SET_MACIPMAP_H | |
1943 | + | |
1944 | +#include <linux/netfilter_ipv4/ip_set.h> | |
1945 | + | |
1946 | +#define SETTYPE_NAME "macipmap" | |
1947 | +#define MAX_RANGE 0x0000FFFF | |
1948 | + | |
1949 | +/* general flags */ | |
1950 | +#define IPSET_MACIP_MATCHUNSET 1 | |
1951 | + | |
1952 | +/* per ip flags */ | |
1953 | +#define IPSET_MACIP_ISSET 1 | |
1954 | + | |
1955 | +struct ip_set_macipmap { | |
1956 | + void *members; /* the macipmap proper */ | |
1957 | + ip_set_ip_t first_ip; /* host byte order, included in range */ | |
1958 | + ip_set_ip_t last_ip; /* host byte order, included in range */ | |
1959 | + u_int32_t flags; | |
1960 | +}; | |
1961 | + | |
1962 | +struct ip_set_req_macipmap_create { | |
1963 | + ip_set_ip_t from; | |
1964 | + ip_set_ip_t to; | |
1965 | + u_int32_t flags; | |
1966 | +}; | |
1967 | + | |
1968 | +struct ip_set_req_macipmap { | |
1969 | + ip_set_ip_t ip; | |
1970 | + unsigned char ethernet[ETH_ALEN]; | |
1971 | +}; | |
1972 | + | |
1973 | +struct ip_set_macip { | |
1974 | + unsigned short flags; | |
1975 | + unsigned char ethernet[ETH_ALEN]; | |
1976 | +}; | |
1977 | + | |
1978 | +#endif /* __IP_SET_MACIPMAP_H */ | |
ae95cca4 PS |
1979 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set_malloc.h include/linux/netfilter_ipv4/ip_set_malloc.h |
1980 | --- include.orig/linux/netfilter_ipv4/ip_set_malloc.h 1970-01-01 01:00:00.000000000 +0100 | |
1981 | +++ include/linux/netfilter_ipv4/ip_set_malloc.h 2005-05-06 22:14:58.000000000 +0200 | |
014436e1 PS |
1982 | @@ -0,0 +1,4 @@ |
1983 | +#ifndef _IP_SET_MALLOC_H | |
1984 | +#define _IP_SET_MALLOC_H | |
1985 | + | |
1986 | +#endif /*_IP_SET_MALLOC_H*/ | |
ae95cca4 PS |
1987 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set_nethash.h include/linux/netfilter_ipv4/ip_set_nethash.h |
1988 | --- include.orig/linux/netfilter_ipv4/ip_set_nethash.h 1970-01-01 01:00:00.000000000 +0100 | |
1989 | +++ include/linux/netfilter_ipv4/ip_set_nethash.h 2005-05-06 22:15:09.000000000 +0200 | |
014436e1 PS |
1990 | @@ -0,0 +1,47 @@ |
1991 | +#ifndef __IP_SET_NETHASH_H | |
1992 | +#define __IP_SET_NETHASH_H | |
1993 | + | |
1994 | +#include <linux/netfilter_ipv4/ip_set.h> | |
1995 | + | |
1996 | +#define SETTYPE_NAME "nethash" | |
1997 | +#define MAX_RANGE 0x0000FFFF | |
1998 | + | |
1999 | +struct ip_set_nethash { | |
2000 | + ip_set_ip_t *members; /* the nethash proper */ | |
2001 | + uint32_t initval; /* initval for jhash_1word */ | |
2002 | + uint32_t prime; /* prime for double hashing */ | |
2003 | + uint32_t hashsize; /* hash size */ | |
2004 | + uint16_t probes; /* max number of probes */ | |
2005 | + uint16_t resize; /* resize factor in percent */ | |
2006 | + unsigned char cidr[30]; /* CIDR sizes */ | |
2007 | +}; | |
2008 | + | |
2009 | +struct ip_set_req_nethash_create { | |
2010 | + uint32_t hashsize; | |
2011 | + uint16_t probes; | |
2012 | + uint16_t resize; | |
2013 | +}; | |
2014 | + | |
2015 | +struct ip_set_req_nethash { | |
2016 | + ip_set_ip_t ip; | |
2017 | + unsigned char cidr; | |
2018 | +}; | |
2019 | + | |
ae95cca4 | 2020 | +static unsigned char shifts[] = {255, 253, 249, 241, 225, 193, 129, 1}; |
014436e1 PS |
2021 | + |
2022 | +static inline ip_set_ip_t | |
2023 | +pack(ip_set_ip_t ip, unsigned char cidr) | |
2024 | +{ | |
2025 | + ip_set_ip_t addr, *paddr = &addr; | |
2026 | + unsigned char n, t, *a; | |
2027 | + | |
2028 | + addr = htonl(ip & (0xFFFFFFFF << (32 - (cidr)))); | |
2029 | + n = cidr / 8; | |
2030 | + t = cidr % 8; | |
2031 | + a = &((unsigned char *)paddr)[n]; | |
2032 | + *a = *a /(1 << (8 - t)) + shifts[t]; | |
2033 | + | |
2034 | + return ntohl(addr); | |
2035 | +} | |
2036 | + | |
2037 | +#endif /* __IP_SET_NETHASH_H */ | |
ae95cca4 PS |
2038 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set_portmap.h include/linux/netfilter_ipv4/ip_set_portmap.h |
2039 | --- include.orig/linux/netfilter_ipv4/ip_set_portmap.h 1970-01-01 01:00:00.000000000 +0100 | |
2040 | +++ include/linux/netfilter_ipv4/ip_set_portmap.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
2041 | @@ -0,0 +1,25 @@ |
2042 | +#ifndef __IP_SET_PORTMAP_H | |
2043 | +#define __IP_SET_PORTMAP_H | |
2044 | + | |
2045 | +#include <linux/netfilter_ipv4/ip_set.h> | |
2046 | + | |
2047 | +#define SETTYPE_NAME "portmap" | |
2048 | +#define MAX_RANGE 0x0000FFFF | |
2049 | +#define INVALID_PORT (MAX_RANGE + 1) | |
2050 | + | |
2051 | +struct ip_set_portmap { | |
2052 | + void *members; /* the portmap proper */ | |
2053 | + ip_set_ip_t first_port; /* host byte order, included in range */ | |
2054 | + ip_set_ip_t last_port; /* host byte order, included in range */ | |
2055 | +}; | |
2056 | + | |
2057 | +struct ip_set_req_portmap_create { | |
2058 | + ip_set_ip_t from; | |
2059 | + ip_set_ip_t to; | |
2060 | +}; | |
2061 | + | |
2062 | +struct ip_set_req_portmap { | |
2063 | + ip_set_ip_t port; | |
2064 | +}; | |
2065 | + | |
2066 | +#endif /* __IP_SET_PORTMAP_H */ | |
ae95cca4 PS |
2067 | diff -uNr include.orig/linux/netfilter_ipv4/ip_set_prime.h include/linux/netfilter_ipv4/ip_set_prime.h |
2068 | --- include.orig/linux/netfilter_ipv4/ip_set_prime.h 1970-01-01 01:00:00.000000000 +0100 | |
2069 | +++ include/linux/netfilter_ipv4/ip_set_prime.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
2070 | @@ -0,0 +1,34 @@ |
2071 | +#ifndef __IP_SET_PRIME_H | |
2072 | +#define __IP_SET_PRIME_H | |
2073 | + | |
2074 | +static inline unsigned make_prime_bound(unsigned nr) | |
2075 | +{ | |
2076 | + unsigned long long nr64 = nr; | |
2077 | + unsigned long long x = 1; | |
2078 | + nr = 1; | |
2079 | + while (x <= nr64) { x <<= 2; nr <<= 1; } | |
2080 | + return nr; | |
2081 | +} | |
2082 | + | |
2083 | +static inline int make_prime_check(unsigned nr) | |
2084 | +{ | |
2085 | + unsigned x = 3; | |
2086 | + unsigned b = make_prime_bound(nr); | |
2087 | + while (x <= b) { | |
2088 | + if (0 == (nr % x)) return 0; | |
2089 | + x += 2; | |
2090 | + } | |
2091 | + return 1; | |
2092 | +} | |
2093 | + | |
2094 | +static unsigned make_prime(unsigned nr) | |
2095 | +{ | |
2096 | + if (0 == (nr & 1)) nr--; | |
2097 | + while (nr > 1) { | |
2098 | + if (make_prime_check(nr)) return nr; | |
2099 | + nr -= 2; | |
2100 | + } | |
2101 | + return 2; | |
2102 | +} | |
2103 | + | |
2104 | +#endif /* __IP_SET_PRIME_H */ | |
ae95cca4 PS |
2105 | diff -uNr include.orig/linux/netfilter_ipv4/ip_tables.h include/linux/netfilter_ipv4/ip_tables.h |
2106 | --- include.orig/linux/netfilter_ipv4/ip_tables.h 2005-03-13 21:53:55.000000000 +0100 | |
2107 | +++ include/linux/netfilter_ipv4/ip_tables.h 2005-05-06 22:43:31.000000000 +0200 | |
2108 | @@ -101,7 +101,8 @@ | |
0fc89030 PS |
2109 | |
2110 | /* Values for "flag" field in struct ipt_ip (general ip structure). */ | |
2111 | #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ | |
2112 | -#define IPT_F_MASK 0x01 /* All possible flag bits mask. */ | |
2113 | +#define IPT_F_GOTO 0x02 /* Set if jump is a goto */ | |
2114 | +#define IPT_F_MASK 0x03 /* All possible flag bits mask. */ | |
2115 | ||
2116 | /* Values for "inv" field in struct ipt_ip. */ | |
2117 | #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ | |
ae95cca4 PS |
2118 | @@ -148,12 +149,23 @@ |
2119 | #define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1) | |
2120 | #define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS | |
2121 | ||
2122 | +#define IPT_SO_SET_ACCOUNT_HANDLE_FREE (IPT_BASE_CTL + 3) | |
2123 | +#define IPT_SO_SET_ACCOUNT_HANDLE_FREE_ALL (IPT_BASE_CTL + 4) | |
2124 | +#define IPT_SO_SET_ACCOUNT_MAX IPT_SO_SET_ACCOUNT_HANDLE_FREE_ALL | |
2125 | + | |
2126 | #define IPT_SO_GET_INFO (IPT_BASE_CTL) | |
2127 | #define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) | |
2128 | #define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) | |
2129 | #define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) | |
2130 | #define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET | |
2131 | ||
2132 | +#define IPT_SO_GET_ACCOUNT_PREPARE_READ (IPT_BASE_CTL + 3) | |
2133 | +#define IPT_SO_GET_ACCOUNT_PREPARE_READ_FLUSH (IPT_BASE_CTL + 4) | |
2134 | +#define IPT_SO_GET_ACCOUNT_GET_DATA (IPT_BASE_CTL + 5) | |
2135 | +#define IPT_SO_GET_ACCOUNT_GET_HANDLE_USAGE (IPT_BASE_CTL + 6) | |
2136 | +#define IPT_SO_GET_ACCOUNT_GET_TABLE_NAMES (IPT_BASE_CTL + 7) | |
2137 | +#define IPT_SO_GET_ACCOUNT_MAX IPT_SO_GET_ACCOUNT_GET_TABLE_NAMES | |
2138 | + | |
2139 | /* CONTINUE verdict for targets */ | |
2140 | #define IPT_CONTINUE 0xFFFFFFFF | |
2141 | ||
2142 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_account.h include/linux/netfilter_ipv4/ipt_account.h | |
2143 | --- include.orig/linux/netfilter_ipv4/ipt_account.h 1970-01-01 01:00:00.000000000 +0100 | |
2144 | +++ include/linux/netfilter_ipv4/ipt_account.h 2005-05-06 09:24:35.000000000 +0200 | |
0fc89030 | 2145 | @@ -0,0 +1,26 @@ |
4f894449 PS |
2146 | +/* |
2147 | + * accounting match (ipt_account.c) | |
0fc89030 | 2148 | + * (C) 2003,2004 by Piotr Gasidlo (quaker@barbara.eu.org) |
4f894449 | 2149 | + * |
0fc89030 | 2150 | + * Version: 0.1.7 |
4f894449 PS |
2151 | + * |
2152 | + * This software is distributed under the terms of GNU GPL | |
2153 | + */ | |
2154 | + | |
2155 | +#ifndef _IPT_ACCOUNT_H_ | |
2156 | +#define _IPT_ACCOUNT_H_ | |
2157 | + | |
2158 | +#define IPT_ACCOUNT_NAME_LEN 64 | |
2159 | + | |
0fc89030 PS |
2160 | +#define IPT_ACCOUNT_NAME "ipt_account" |
2161 | +#define IPT_ACCOUNT_VERSION "0.1.7" | |
2162 | + | |
4f894449 PS |
2163 | +struct t_ipt_account_info { |
2164 | + char name[IPT_ACCOUNT_NAME_LEN]; | |
2165 | + u_int32_t network; | |
2166 | + u_int32_t netmask; | |
0fc89030 | 2167 | + int shortlisting:1; |
4f894449 PS |
2168 | +}; |
2169 | + | |
2170 | +#endif | |
0fc89030 | 2171 | + |
ae95cca4 PS |
2172 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_ACCOUNT.h include/linux/netfilter_ipv4/ipt_ACCOUNT.h |
2173 | --- include.orig/linux/netfilter_ipv4/ipt_ACCOUNT.h 1970-01-01 01:00:00.000000000 +0100 | |
2174 | +++ include/linux/netfilter_ipv4/ipt_ACCOUNT.h 2005-05-06 09:24:35.000000000 +0200 | |
2175 | @@ -0,0 +1,100 @@ | |
2176 | +/*************************************************************************** | |
2177 | + * Copyright (C) 2004 by Intra2net AG * | |
2178 | + * opensource@intra2net.com * | |
2179 | + * * | |
2180 | + * This program is free software; you can redistribute it and/or modify * | |
2181 | + * it under the terms of the GNU General Public License * | |
2182 | + * version 2 as published by the Free Software Foundation; * | |
2183 | + * * | |
2184 | + ***************************************************************************/ | |
2185 | + | |
2186 | +#ifndef _IPT_ACCOUNT_H | |
2187 | +#define _IPT_ACCOUNT_H | |
2188 | + | |
2189 | +#define ACCOUNT_MAX_TABLES 32 | |
2190 | +#define ACCOUNT_TABLE_NAME_LEN 32 | |
2191 | +#define ACCOUNT_MAX_HANDLES 10 | |
2192 | + | |
2193 | +/* Structure for the userspace part of ipt_ACCOUNT */ | |
2194 | +struct ipt_acc_info { | |
2195 | + u_int32_t net_ip; | |
2196 | + u_int32_t net_mask; | |
2197 | + char table_name[ACCOUNT_TABLE_NAME_LEN]; | |
2198 | + int32_t table_nr; | |
2199 | +}; | |
2200 | + | |
2201 | +/* Internal table structure, generated by check_entry() */ | |
2202 | +struct ipt_acc_table { | |
2203 | + char name[ACCOUNT_TABLE_NAME_LEN]; /* name of the table */ | |
2204 | + u_int32_t ip; /* base IP of network */ | |
2205 | + u_int32_t netmask; /* netmask of the network */ | |
2206 | + unsigned char depth; /* size of network: | |
2207 | + 0: 8 bit, 1: 16bit, 2: 24 bit */ | |
2208 | + u_int32_t refcount; /* refcount of this table. | |
2209 | + if zero, destroy it */ | |
2210 | + u_int32_t itemcount; /* number of IPs in this table */ | |
2211 | + void *data; /* pointer to the actual data, | |
2212 | + depending on netmask */ | |
2213 | +}; | |
2214 | + | |
2215 | +/* Internal handle structure */ | |
2216 | +struct ipt_acc_handle { | |
2217 | + u_int32_t ip; /* base IP of network. Used for | |
2218 | + caculating the final IP during | |
2219 | + get_data() */ | |
2220 | + unsigned char depth; /* size of network. See above for | |
2221 | + details */ | |
2222 | + u_int32_t itemcount; /* number of IPs in this table */ | |
2223 | + void *data; /* pointer to the actual data, | |
2224 | + depending on size */ | |
2225 | +}; | |
2226 | + | |
2227 | +/* Handle structure for communication with the userspace library */ | |
2228 | +struct ipt_acc_handle_sockopt { | |
2229 | + u_int32_t handle_nr; /* Used for HANDLE_FREE */ | |
2230 | + char name[ACCOUNT_TABLE_NAME_LEN]; /* Used for HANDLE_PREPARE_READ/ | |
2231 | + HANDLE_READ_FLUSH */ | |
2232 | + u_int32_t itemcount; /* Used for HANDLE_PREPARE_READ/ | |
2233 | + HANDLE_READ_FLUSH */ | |
2234 | +}; | |
2235 | + | |
2236 | +/* Used for every IP entry | |
2237 | + Size is 16 bytes so that 256 (class C network) * 16 | |
2238 | + fits in one kernel (zero) page */ | |
2239 | +struct ipt_acc_ip { | |
2240 | + u_int32_t src_packets; | |
2241 | + u_int32_t src_bytes; | |
2242 | + u_int32_t dst_packets; | |
2243 | + u_int32_t dst_bytes; | |
2244 | +}; | |
2245 | + | |
2246 | +/* | |
2247 | + Used for every IP when returning data | |
2248 | +*/ | |
2249 | +struct ipt_acc_handle_ip { | |
2250 | + u_int32_t ip; | |
2251 | + u_int32_t src_packets; | |
2252 | + u_int32_t src_bytes; | |
2253 | + u_int32_t dst_packets; | |
2254 | + u_int32_t dst_bytes; | |
2255 | +}; | |
2256 | + | |
2257 | +/* | |
2258 | + The IPs are organized as an array so that direct slot | |
2259 | + calculations are possible. | |
2260 | + Only 8 bit networks are preallocated, 16/24 bit networks | |
2261 | + allocate their slots when needed -> very efficent. | |
2262 | +*/ | |
2263 | +struct ipt_acc_mask_24 { | |
2264 | + struct ipt_acc_ip ip[256]; | |
2265 | +}; | |
2266 | + | |
2267 | +struct ipt_acc_mask_16 { | |
2268 | + struct ipt_acc_mask_24 *mask_24[256]; | |
2269 | +}; | |
2270 | + | |
2271 | +struct ipt_acc_mask_8 { | |
2272 | + struct ipt_acc_mask_16 *mask_16[256]; | |
2273 | +}; | |
2274 | + | |
2275 | +#endif /*_IPT_ACCOUNT_H*/ | |
2276 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_addrtype.h include/linux/netfilter_ipv4/ipt_addrtype.h | |
2277 | --- include.orig/linux/netfilter_ipv4/ipt_addrtype.h 2004-10-31 20:56:02.000000000 +0100 | |
2278 | +++ include/linux/netfilter_ipv4/ipt_addrtype.h 2005-05-06 09:24:35.000000000 +0200 | |
2279 | @@ -4,8 +4,8 @@ | |
2280 | struct ipt_addrtype_info { | |
2281 | u_int16_t source; /* source-type mask */ | |
2282 | u_int16_t dest; /* dest-type mask */ | |
2283 | - u_int32_t invert_source; | |
2284 | - u_int32_t invert_dest; | |
2285 | + int invert_source; | |
2286 | + int invert_dest; | |
2287 | }; | |
2288 | ||
2289 | #endif | |
2290 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_CLUSTERIP.h include/linux/netfilter_ipv4/ipt_CLUSTERIP.h | |
2291 | --- include.orig/linux/netfilter_ipv4/ipt_CLUSTERIP.h 2005-01-08 15:03:55.000000000 +0100 | |
2292 | +++ include/linux/netfilter_ipv4/ipt_CLUSTERIP.h 2005-05-06 09:24:35.000000000 +0200 | |
2293 | @@ -9,7 +9,7 @@ | |
2294 | ||
2295 | #define CLUSTERIP_HASHMODE_MAX CLUSTERIP_HASHMODE_SIP_SPT_DPT | |
2296 | ||
2297 | -#define CLUSTERIP_MAX_NODES 16 | |
2298 | +#define CLUSTERIP_MAX_NODES 8 | |
2299 | ||
2300 | #define CLUSTERIP_FLAG_NEW 0x00000001 | |
2301 | ||
2302 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_connlimit.h include/linux/netfilter_ipv4/ipt_connlimit.h | |
2303 | --- include.orig/linux/netfilter_ipv4/ipt_connlimit.h 1970-01-01 01:00:00.000000000 +0100 | |
2304 | +++ include/linux/netfilter_ipv4/ipt_connlimit.h 2005-05-06 09:24:35.000000000 +0200 | |
ab88a259 PS |
2305 | @@ -0,0 +1,12 @@ |
2306 | +#ifndef _IPT_CONNLIMIT_H | |
2307 | +#define _IPT_CONNLIMIT_H | |
2308 | + | |
2309 | +struct ipt_connlimit_data; | |
2310 | + | |
2311 | +struct ipt_connlimit_info { | |
2312 | + int limit; | |
2313 | + int inverse; | |
2314 | + u_int32_t mask; | |
2315 | + struct ipt_connlimit_data *data; | |
2316 | +}; | |
2317 | +#endif /* _IPT_CONNLIMIT_H */ | |
ae95cca4 PS |
2318 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_conntrack.h include/linux/netfilter_ipv4/ipt_conntrack.h |
2319 | --- include.orig/linux/netfilter_ipv4/ipt_conntrack.h 2005-03-26 19:58:02.000000000 +0100 | |
2320 | +++ include/linux/netfilter_ipv4/ipt_conntrack.h 2005-04-30 03:30:23.000000000 +0200 | |
2321 | @@ -5,8 +5,6 @@ | |
2322 | #ifndef _IPT_CONNTRACK_H | |
2323 | #define _IPT_CONNTRACK_H | |
2324 | ||
2325 | -#include <asm/types.h> | |
2326 | - | |
2327 | #define IPT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) | |
2328 | #define IPT_CONNTRACK_STATE_INVALID (1 << 0) | |
2329 | ||
2330 | @@ -41,7 +39,7 @@ | |
2331 | } u; | |
2332 | ||
2333 | /* The protocol. */ | |
2334 | - __u16 protonum; | |
2335 | + u16 protonum; | |
2336 | } dst; | |
2337 | }; | |
2338 | ||
2339 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_fuzzy.h include/linux/netfilter_ipv4/ipt_fuzzy.h | |
2340 | --- include.orig/linux/netfilter_ipv4/ipt_fuzzy.h 1970-01-01 01:00:00.000000000 +0100 | |
2341 | +++ include/linux/netfilter_ipv4/ipt_fuzzy.h 2005-05-06 09:24:35.000000000 +0200 | |
bab37e86 PS |
2342 | @@ -0,0 +1,21 @@ |
2343 | +#ifndef _IPT_FUZZY_H | |
2344 | +#define _IPT_FUZZY_H | |
2345 | + | |
2346 | +#include <linux/param.h> | |
2347 | +#include <linux/types.h> | |
2348 | + | |
2349 | +#define MAXFUZZYRATE 10000000 | |
2350 | +#define MINFUZZYRATE 3 | |
2351 | + | |
2352 | +struct ipt_fuzzy_info { | |
2353 | + u_int32_t minimum_rate; | |
2354 | + u_int32_t maximum_rate; | |
2355 | + u_int32_t packets_total; | |
2356 | + u_int32_t bytes_total; | |
2357 | + u_int32_t previous_time; | |
2358 | + u_int32_t present_time; | |
2359 | + u_int32_t mean_rate; | |
2360 | + u_int8_t acceptance_rate; | |
2361 | +}; | |
2362 | + | |
2363 | +#endif /*_IPT_FUZZY_H*/ | |
ae95cca4 PS |
2364 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_geoip.h include/linux/netfilter_ipv4/ipt_geoip.h |
2365 | --- include.orig/linux/netfilter_ipv4/ipt_geoip.h 1970-01-01 01:00:00.000000000 +0100 | |
2366 | +++ include/linux/netfilter_ipv4/ipt_geoip.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
2367 | @@ -0,0 +1,50 @@ |
2368 | +/* ipt_geoip.h header file for libipt_geoip.c and ipt_geoip.c | |
2369 | + * | |
2370 | + * This program is free software; you can redistribute it and/or modify | |
2371 | + * it under the terms of the GNU General Public License as published by | |
2372 | + * the Free Software Foundation; either version 2 of the License, or | |
2373 | + * (at your option) any later version. | |
2374 | + * | |
2375 | + * Copyright (c) 2004 Cookinglinux | |
2376 | + */ | |
2377 | +#ifndef _IPT_GEOIP_H | |
2378 | +#define _IPT_GEOIP_H | |
2379 | + | |
2380 | +#define IPT_GEOIP_SRC 0x01 /* Perform check on Source IP */ | |
2381 | +#define IPT_GEOIP_DST 0x02 /* Perform check on Destination IP */ | |
2382 | +#define IPT_GEOIP_INV 0x04 /* Negate the condition */ | |
2383 | + | |
2384 | +#define IPT_GEOIP_MAX 15 /* Maximum of countries */ | |
2385 | + | |
2386 | +struct geoip_subnet { | |
2387 | + u_int32_t begin; | |
2388 | + u_int32_t end; | |
2389 | +}; | |
2390 | + | |
2391 | +struct geoip_info { | |
2392 | + struct geoip_subnet *subnets; | |
2393 | + u_int32_t count; | |
2394 | + u_int32_t ref; | |
2395 | + u_int16_t cc; | |
2396 | + struct geoip_info *next; | |
2397 | + struct geoip_info *prev; | |
2398 | +}; | |
2399 | + | |
2400 | +struct ipt_geoip_info { | |
2401 | + u_int8_t flags; | |
2402 | + u_int8_t count; | |
2403 | + u_int16_t cc[IPT_GEOIP_MAX]; | |
2404 | + | |
2405 | + /* Used internally by the kernel */ | |
2406 | + struct geoip_info *mem[IPT_GEOIP_MAX]; | |
2407 | + u_int8_t *refcount; | |
2408 | + | |
2409 | + /* not implemented yet: | |
2410 | + void *fini; | |
2411 | + */ | |
2412 | +}; | |
2413 | + | |
2414 | +#define COUNTRY(cc) (cc >> 8), (cc & 0x00FF) | |
2415 | + | |
2416 | +#endif | |
2417 | + | |
ae95cca4 PS |
2418 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_IMQ.h include/linux/netfilter_ipv4/ipt_IMQ.h |
2419 | --- include.orig/linux/netfilter_ipv4/ipt_IMQ.h 1970-01-01 01:00:00.000000000 +0100 | |
2420 | +++ include/linux/netfilter_ipv4/ipt_IMQ.h 2005-05-06 09:24:35.000000000 +0200 | |
bab37e86 PS |
2421 | @@ -0,0 +1,8 @@ |
2422 | +#ifndef _IPT_IMQ_H | |
2423 | +#define _IPT_IMQ_H | |
2424 | + | |
2425 | +struct ipt_imq_info { | |
ac0c4b1f | 2426 | + unsigned int todev; /* target imq device */ |
bab37e86 PS |
2427 | +}; |
2428 | + | |
2429 | +#endif /* _IPT_IMQ_H */ | |
ae95cca4 PS |
2430 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_IPMARK.h include/linux/netfilter_ipv4/ipt_IPMARK.h |
2431 | --- include.orig/linux/netfilter_ipv4/ipt_IPMARK.h 1970-01-01 01:00:00.000000000 +0100 | |
2432 | +++ include/linux/netfilter_ipv4/ipt_IPMARK.h 2005-05-06 09:24:35.000000000 +0200 | |
bab37e86 PS |
2433 | @@ -0,0 +1,13 @@ |
2434 | +#ifndef _IPT_IPMARK_H_target | |
2435 | +#define _IPT_IPMARK_H_target | |
2436 | + | |
2437 | +struct ipt_ipmark_target_info { | |
2438 | + unsigned long andmask; | |
2439 | + unsigned long ormask; | |
2440 | + unsigned int addr; | |
2441 | +}; | |
2442 | + | |
2443 | +#define IPT_IPMARK_SRC 0 | |
2444 | +#define IPT_IPMARK_DST 1 | |
2445 | + | |
2446 | +#endif /*_IPT_IPMARK_H_target*/ | |
ae95cca4 PS |
2447 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_ipp2p.h include/linux/netfilter_ipv4/ipt_ipp2p.h |
2448 | --- include.orig/linux/netfilter_ipv4/ipt_ipp2p.h 1970-01-01 01:00:00.000000000 +0100 | |
2449 | +++ include/linux/netfilter_ipv4/ipt_ipp2p.h 2005-05-06 09:24:35.000000000 +0200 | |
014436e1 PS |
2450 | @@ -0,0 +1,29 @@ |
2451 | +#ifndef __IPT_IPP2P_H | |
2452 | +#define __IPT_IPP2P_H | |
2453 | +#define IPP2P_VERSION "0.7.2" | |
2454 | + | |
2455 | +struct ipt_p2p_info { | |
2456 | + int cmd; | |
2457 | + int debug; | |
2458 | +}; | |
2459 | + | |
2460 | +#endif //__IPT_IPP2P_H | |
2461 | + | |
2462 | +#define SHORT_HAND_IPP2P 1 /* --ipp2p switch*/ | |
2463 | +#define SHORT_HAND_DATA 4 /* --ipp2p-data switch*/ | |
2464 | +#define SHORT_HAND_NONE 5 /* no short hand*/ | |
2465 | + | |
2466 | +#define IPP2P_EDK 2 | |
2467 | +#define IPP2P_DATA_KAZAA 8 | |
2468 | +#define IPP2P_DATA_EDK 16 | |
2469 | +#define IPP2P_DATA_DC 32 | |
2470 | +#define IPP2P_DC 64 | |
2471 | +#define IPP2P_DATA_GNU 128 | |
2472 | +#define IPP2P_GNU 256 | |
2473 | +#define IPP2P_KAZAA 512 | |
2474 | +#define IPP2P_BIT 1024 | |
2475 | +#define IPP2P_APPLE 2048 | |
2476 | +#define IPP2P_SOUL 4096 | |
2477 | +#define IPP2P_WINMX 8192 | |
2478 | +#define IPP2P_ARES 16384 | |
2479 | + | |
ae95cca4 PS |
2480 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_ipv4options.h include/linux/netfilter_ipv4/ipt_ipv4options.h |
2481 | --- include.orig/linux/netfilter_ipv4/ipt_ipv4options.h 1970-01-01 01:00:00.000000000 +0100 | |
2482 | +++ include/linux/netfilter_ipv4/ipt_ipv4options.h 2005-05-06 09:24:35.000000000 +0200 | |
bab37e86 PS |
2483 | @@ -0,0 +1,21 @@ |
2484 | +#ifndef __ipt_ipv4options_h_included__ | |
2485 | +#define __ipt_ipv4options_h_included__ | |
2486 | + | |
2487 | +#define IPT_IPV4OPTION_MATCH_SSRR 0x01 /* For strict source routing */ | |
2488 | +#define IPT_IPV4OPTION_MATCH_LSRR 0x02 /* For loose source routing */ | |
2489 | +#define IPT_IPV4OPTION_DONT_MATCH_SRR 0x04 /* any source routing */ | |
2490 | +#define IPT_IPV4OPTION_MATCH_RR 0x08 /* For Record route */ | |
2491 | +#define IPT_IPV4OPTION_DONT_MATCH_RR 0x10 | |
2492 | +#define IPT_IPV4OPTION_MATCH_TIMESTAMP 0x20 /* For timestamp request */ | |
2493 | +#define IPT_IPV4OPTION_DONT_MATCH_TIMESTAMP 0x40 | |
2494 | +#define IPT_IPV4OPTION_MATCH_ROUTER_ALERT 0x80 /* For router-alert */ | |
2495 | +#define IPT_IPV4OPTION_DONT_MATCH_ROUTER_ALERT 0x100 | |
2496 | +#define IPT_IPV4OPTION_MATCH_ANY_OPT 0x200 /* match packet with any option */ | |
2497 | +#define IPT_IPV4OPTION_DONT_MATCH_ANY_OPT 0x400 /* match packet with no option */ | |
2498 | + | |
2499 | +struct ipt_ipv4options_info { | |
2500 | + u_int16_t options; | |
2501 | +}; | |
2502 | + | |
2503 | + | |
2504 | +#endif /* __ipt_ipv4options_h_included__ */ | |
ae95cca4 PS |
2505 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_layer7.h include/linux/netfilter_ipv4/ipt_layer7.h |
2506 | --- include.orig/linux/netfilter_ipv4/ipt_layer7.h 1970-01-01 01:00:00.000000000 +0100 | |
2507 | +++ include/linux/netfilter_ipv4/ipt_layer7.h 2005-05-06 09:24:35.000000000 +0200 | |
2508 | @@ -0,0 +1,26 @@ | |
2509 | +/* | |
2510 | + By Matthew Strait <quadong@users.sf.net>, Dec 2003. | |
2511 | + http://l7-filter.sf.net | |
2512 | + | |
2513 | + This program is free software; you can redistribute it and/or | |
2514 | + modify it under the terms of the GNU General Public License | |
2515 | + as published by the Free Software Foundation; either version | |
2516 | + 2 of the License, or (at your option) any later version. | |
2517 | + http://www.gnu.org/licenses/gpl.txt | |
2518 | +*/ | |
2519 | + | |
2520 | +#ifndef _IPT_LAYER7_H | |
2521 | +#define _IPT_LAYER7_H | |
2522 | + | |
2523 | +#define MAX_PATTERN_LEN 8192 | |
2524 | +#define MAX_PROTOCOL_LEN 256 | |
2525 | + | |
2526 | +typedef char *(*proc_ipt_search) (char *, char, char *); | |
2527 | + | |
2528 | +struct ipt_layer7_info { | |
2529 | + char protocol[MAX_PROTOCOL_LEN]; | |
2530 | + char invert:1; | |
2531 | + char pattern[MAX_PATTERN_LEN]; | |
2532 | +}; | |
2533 | + | |
2534 | +#endif /* _IPT_LAYER7_H */ | |
2535 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_nth.h include/linux/netfilter_ipv4/ipt_nth.h | |
2536 | --- include.orig/linux/netfilter_ipv4/ipt_nth.h 1970-01-01 01:00:00.000000000 +0100 | |
2537 | +++ include/linux/netfilter_ipv4/ipt_nth.h 2005-05-06 09:24:35.000000000 +0200 | |
bab37e86 PS |
2538 | @@ -0,0 +1,19 @@ |
2539 | +#ifndef _IPT_NTH_H | |
2540 | +#define _IPT_NTH_H | |
2541 | + | |
2542 | +#include <linux/param.h> | |
2543 | +#include <linux/types.h> | |
2544 | + | |
2545 | +#ifndef IPT_NTH_NUM_COUNTERS | |
2546 | +#define IPT_NTH_NUM_COUNTERS 16 | |
2547 | +#endif | |
2548 | + | |
2549 | +struct ipt_nth_info { | |
2550 | + u_int8_t every; | |
2551 | + u_int8_t not; | |
2552 | + u_int8_t startat; | |
2553 | + u_int8_t counter; | |
2554 | + u_int8_t packet; | |
2555 | +}; | |
2556 | + | |
2557 | +#endif /*_IPT_NTH_H*/ | |
ae95cca4 PS |
2558 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_osf.h include/linux/netfilter_ipv4/ipt_osf.h |
2559 | --- include.orig/linux/netfilter_ipv4/ipt_osf.h 1970-01-01 01:00:00.000000000 +0100 | |
2560 | +++ include/linux/netfilter_ipv4/ipt_osf.h 2005-05-06 22:16:43.000000000 +0200 | |
2561 | @@ -0,0 +1,94 @@ | |
0fc89030 PS |
2562 | +/* |
2563 | + * ipt_osf.h | |
2564 | + * | |
2565 | + * Copyright (c) 2003 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | |
2566 | + * | |
2567 | + * | |
2568 | + * This program is free software; you can redistribute it and/or modify | |
2569 | + * it under the terms of the GNU General Public License as published by | |
2570 | + * the Free Software Foundation; either version 2 of the License, or | |
2571 | + * (at your option) any later version. | |
2572 | + * | |
2573 | + * This program is distributed in the hope that it will be useful, | |
2574 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
2575 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
2576 | + * GNU General Public License for more details. | |
2577 | + * | |
2578 | + * You should have received a copy of the GNU General Public License | |
2579 | + * along with this program; if not, write to the Free Software | |
2580 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
2581 | + */ | |
2582 | + | |
2583 | +#ifndef _IPT_OSF_H | |
2584 | +#define _IPT_OSF_H | |
2585 | + | |
2586 | +#define MAXGENRELEN 32 | |
2587 | +#define MAXDETLEN 64 | |
2588 | + | |
2589 | +#define IPT_OSF_GENRE 1 | |
2590 | +#define IPT_OSF_SMART 2 | |
2591 | +#define IPT_OSF_LOG 4 | |
2592 | +#define IPT_OSF_NETLINK 8 | |
2593 | + | |
2594 | +#define IPT_OSF_LOGLEVEL_ALL 0 | |
2595 | +#define IPT_OSF_LOGLEVEL_FIRST 1 | |
2596 | + | |
ae95cca4 PS |
2597 | +#include <netinet/ip.h> |
2598 | +#include <netinet/tcp.h> | |
2599 | + | |
2600 | +struct list_head | |
2601 | +{ | |
2602 | + struct list_head *prev, *next; | |
2603 | +}; | |
2604 | + | |
0fc89030 PS |
2605 | +struct ipt_osf_info |
2606 | +{ | |
2607 | + char genre[MAXGENRELEN]; | |
2608 | + int len; | |
2609 | + unsigned long flags; | |
2610 | + int loglevel; | |
2611 | + int invert; /* UNSUPPORTED */ | |
2612 | +}; | |
2613 | + | |
2614 | +struct osf_wc | |
2615 | +{ | |
2616 | + char wc; | |
2617 | + unsigned long val; | |
2618 | +}; | |
2619 | + | |
2620 | +/* This struct represents IANA options | |
2621 | + * http://www.iana.org/assignments/tcp-parameters | |
2622 | + */ | |
2623 | +struct osf_opt | |
2624 | +{ | |
2625 | + unsigned char kind; | |
2626 | + unsigned char length; | |
2627 | + struct osf_wc wc; | |
2628 | +}; | |
2629 | + | |
2630 | +struct osf_finger | |
2631 | +{ | |
ae95cca4 | 2632 | + struct list_head flist; |
0fc89030 PS |
2633 | + struct osf_wc wss; |
2634 | + unsigned char ttl; | |
2635 | + unsigned char df; | |
2636 | + unsigned long ss; | |
2637 | + unsigned char genre[MAXGENRELEN]; | |
2638 | + unsigned char version[MAXGENRELEN], subtype[MAXGENRELEN]; | |
2639 | + | |
2640 | + /* Not needed, but for consistency with original table from Michal Zalewski */ | |
2641 | + unsigned char details[MAXDETLEN]; | |
2642 | + | |
2643 | + int opt_num; | |
2644 | + struct osf_opt opt[MAX_IPOPTLEN]; /* In case it is all NOP or EOL */ | |
2645 | + | |
2646 | +}; | |
2647 | + | |
2648 | +struct ipt_osf_nlmsg | |
2649 | +{ | |
2650 | + struct osf_finger f; | |
2651 | + struct iphdr ip; | |
2652 | + struct tcphdr tcp; | |
2653 | +}; | |
2654 | + | |
2655 | +#endif /* _IPT_OSF_H */ | |
ae95cca4 PS |
2656 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_policy.h include/linux/netfilter_ipv4/ipt_policy.h |
2657 | --- include.orig/linux/netfilter_ipv4/ipt_policy.h 1970-01-01 01:00:00.000000000 +0100 | |
2658 | +++ include/linux/netfilter_ipv4/ipt_policy.h 2005-05-06 09:24:35.000000000 +0200 | |
bab37e86 PS |
2659 | @@ -0,0 +1,52 @@ |
2660 | +#ifndef _IPT_POLICY_H | |
2661 | +#define _IPT_POLICY_H | |
2662 | + | |
2663 | +#define POLICY_MAX_ELEM 4 | |
2664 | + | |
2665 | +enum ipt_policy_flags | |
2666 | +{ | |
2667 | + POLICY_MATCH_IN = 0x1, | |
2668 | + POLICY_MATCH_OUT = 0x2, | |
2669 | + POLICY_MATCH_NONE = 0x4, | |
2670 | + POLICY_MATCH_STRICT = 0x8, | |
2671 | +}; | |
2672 | + | |
2673 | +enum ipt_policy_modes | |
2674 | +{ | |
2675 | + POLICY_MODE_TRANSPORT, | |
2676 | + POLICY_MODE_TUNNEL | |
2677 | +}; | |
2678 | + | |
2679 | +struct ipt_policy_spec | |
2680 | +{ | |
2681 | + u_int8_t saddr:1, | |
2682 | + daddr:1, | |
2683 | + proto:1, | |
2684 | + mode:1, | |
2685 | + spi:1, | |
2686 | + reqid:1; | |
2687 | +}; | |
2688 | + | |
2689 | +struct ipt_policy_elem | |
2690 | +{ | |
2691 | + u_int32_t saddr; | |
2692 | + u_int32_t smask; | |
2693 | + u_int32_t daddr; | |
2694 | + u_int32_t dmask; | |
2695 | + u_int32_t spi; | |
2696 | + u_int32_t reqid; | |
2697 | + u_int8_t proto; | |
2698 | + u_int8_t mode; | |
2699 | + | |
2700 | + struct ipt_policy_spec match; | |
2701 | + struct ipt_policy_spec invert; | |
2702 | +}; | |
2703 | + | |
2704 | +struct ipt_policy_info | |
2705 | +{ | |
2706 | + struct ipt_policy_elem pol[POLICY_MAX_ELEM]; | |
2707 | + u_int16_t flags; | |
2708 | + u_int16_t len; | |
2709 | +}; | |
2710 | + | |
2711 | +#endif /* _IPT_POLICY_H */ | |
ae95cca4 PS |
2712 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_psd.h include/linux/netfilter_ipv4/ipt_psd.h |
2713 | --- include.orig/linux/netfilter_ipv4/ipt_psd.h 1970-01-01 01:00:00.000000000 +0100 | |
2714 | +++ include/linux/netfilter_ipv4/ipt_psd.h 2005-05-06 09:24:35.000000000 +0200 | |
2715 | @@ -0,0 +1,40 @@ | |
2716 | +#ifndef _IPT_PSD_H | |
2717 | +#define _IPT_PSD_H | |
2718 | + | |
2719 | +#include <linux/param.h> | |
2720 | +#include <linux/types.h> | |
2721 | + | |
2722 | +/* | |
2723 | + * High port numbers have a lower weight to reduce the frequency of false | |
2724 | + * positives, such as from passive mode FTP transfers. | |
2725 | + */ | |
2726 | +#define PORT_WEIGHT_PRIV 3 | |
2727 | +#define PORT_WEIGHT_HIGH 1 | |
2728 | + | |
2729 | +/* | |
2730 | + * Port scan detection thresholds: at least COUNT ports need to be scanned | |
2731 | + * from the same source, with no longer than DELAY ticks between ports. | |
2732 | + */ | |
2733 | +#define SCAN_MIN_COUNT 7 | |
2734 | +#define SCAN_MAX_COUNT (SCAN_MIN_COUNT * PORT_WEIGHT_PRIV) | |
2735 | +#define SCAN_WEIGHT_THRESHOLD SCAN_MAX_COUNT | |
2736 | +#define SCAN_DELAY_THRESHOLD (300) /* old usage of HZ here was erroneously and broke under uml */ | |
2737 | + | |
2738 | +/* | |
2739 | + * Keep track of up to LIST_SIZE source addresses, using a hash table of | |
2740 | + * HASH_SIZE entries for faster lookups, but limiting hash collisions to | |
2741 | + * HASH_MAX source addresses per the same hash value. | |
2742 | + */ | |
2743 | +#define LIST_SIZE 0x100 | |
2744 | +#define HASH_LOG 9 | |
2745 | +#define HASH_SIZE (1 << HASH_LOG) | |
2746 | +#define HASH_MAX 0x10 | |
2747 | + | |
2748 | +struct ipt_psd_info { | |
2749 | + unsigned int weight_threshold; | |
2750 | + unsigned int delay_threshold; | |
2751 | + unsigned short lo_ports_weight; | |
2752 | + unsigned short hi_ports_weight; | |
2753 | +}; | |
2754 | + | |
2755 | +#endif /*_IPT_PSD_H*/ | |
2756 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_quota.h include/linux/netfilter_ipv4/ipt_quota.h | |
2757 | --- include.orig/linux/netfilter_ipv4/ipt_quota.h 1970-01-01 01:00:00.000000000 +0100 | |
2758 | +++ include/linux/netfilter_ipv4/ipt_quota.h 2005-05-06 09:24:35.000000000 +0200 | |
2759 | @@ -0,0 +1,12 @@ | |
2760 | +#ifndef _IPT_QUOTA_H | |
2761 | +#define _IPT_QUOTA_H | |
2762 | + | |
2763 | +/* print debug info in both kernel/netfilter module & iptable library */ | |
2764 | +//#define DEBUG_IPT_QUOTA | |
2765 | + | |
2766 | +struct ipt_quota_info { | |
2767 | + u_int64_t quota; | |
2768 | + struct ipt_quota_info *master; | |
2769 | +}; | |
2770 | + | |
2771 | +#endif /*_IPT_QUOTA_H*/ | |
2772 | diff -uNr include.orig/linux/netfilter_ipv4/ipt_ROUTE.h include/linux/netfilter_ipv4/ipt_ROUTE.h | |
2773 | --- include.orig/linux/netfilter_ipv4/ipt_ROUTE.h 1970-01-01 01:00:00.000000000 +0100 | |
2774 | +++ include/linux/netfilter_ipv4/ipt_ROUTE.h 2005-05-06 09:24:35.000000000 +0200 | |
2775 | @@ -0,0 +1,23 @@ | |
2776 | +/* Header file for iptables ipt_ROUTE target | |
2777 | + * | |
2778 |