]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/linux/netfilter/x_tables.h
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
[net-next-2.6.git] / include / linux / netfilter / x_tables.h
CommitLineData
2e4e6a17
HW
1#ifndef _X_TABLES_H
2#define _X_TABLES_H
a79ff731 3#include <linux/kernel.h>
60c195c7
AB
4#include <linux/types.h>
5
2e4e6a17 6#define XT_FUNCTION_MAXNAMELEN 30
4b2cbd42 7#define XT_EXTENSION_MAXNAMELEN 29
2e4e6a17
HW
8#define XT_TABLE_MAXNAMELEN 32
9
d94d9fee 10struct xt_entry_match {
1e30a014
DM
11 union {
12 struct {
60c195c7 13 __u16 match_size;
1e30a014
DM
14
15 /* Used by userspace */
4b2cbd42 16 char name[XT_EXTENSION_MAXNAMELEN];
60c195c7 17 __u8 revision;
1e30a014
DM
18 } user;
19 struct {
60c195c7 20 __u16 match_size;
1e30a014
DM
21
22 /* Used inside the kernel */
23 struct xt_match *match;
24 } kernel;
25
26 /* Total length */
60c195c7 27 __u16 match_size;
1e30a014
DM
28 } u;
29
30 unsigned char data[0];
31};
32
d94d9fee 33struct xt_entry_target {
1e30a014
DM
34 union {
35 struct {
60c195c7 36 __u16 target_size;
1e30a014
DM
37
38 /* Used by userspace */
4b2cbd42 39 char name[XT_EXTENSION_MAXNAMELEN];
60c195c7 40 __u8 revision;
1e30a014
DM
41 } user;
42 struct {
60c195c7 43 __u16 target_size;
1e30a014
DM
44
45 /* Used inside the kernel */
46 struct xt_target *target;
47 } kernel;
48
49 /* Total length */
60c195c7 50 __u16 target_size;
1e30a014
DM
51 } u;
52
53 unsigned char data[0];
54};
55
3c2ad469
PM
56#define XT_TARGET_INIT(__name, __size) \
57{ \
58 .target.u.user = { \
59 .target_size = XT_ALIGN(__size), \
60 .name = __name, \
61 }, \
62}
63
d94d9fee 64struct xt_standard_target {
1e30a014
DM
65 struct xt_entry_target target;
66 int verdict;
67};
68
75f0a0fd
JE
69struct xt_error_target {
70 struct xt_entry_target target;
71 char errorname[XT_FUNCTION_MAXNAMELEN];
72};
73
2e4e6a17
HW
74/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
75 * kernel supports, if >= revision. */
d94d9fee 76struct xt_get_revision {
4b2cbd42 77 char name[XT_EXTENSION_MAXNAMELEN];
60c195c7 78 __u8 revision;
2e4e6a17
HW
79};
80
81/* CONTINUE verdict for targets */
82#define XT_CONTINUE 0xFFFFFFFF
83
84/* For standard target */
85#define XT_RETURN (-NF_REPEAT - 1)
86
6fbfc968
DM
87/* this is a dummy structure to find out the alignment requirement for a struct
88 * containing all the fundamental data types that are used in ipt_entry,
89 * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my
90 * personal pleasure to remove it -HW
91 */
d94d9fee 92struct _xt_align {
60c195c7
AB
93 __u8 u8;
94 __u16 u16;
95 __u32 u32;
96 __u64 u64;
6fbfc968
DM
97};
98
a79ff731 99#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
2e4e6a17
HW
100
101/* Standard return verdict, or do jump. */
102#define XT_STANDARD_TARGET ""
103/* Error verdict. */
104#define XT_ERROR_TARGET "ERROR"
105
2e4e6a17
HW
106#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
107#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
108
d94d9fee 109struct xt_counters {
60c195c7 110 __u64 pcnt, bcnt; /* Packet and byte counters */
2e4e6a17
HW
111};
112
113/* The argument to IPT_SO_ADD_COUNTERS. */
d94d9fee 114struct xt_counters_info {
2e4e6a17
HW
115 /* Which table. */
116 char name[XT_TABLE_MAXNAMELEN];
117
118 unsigned int num_counters;
119
120 /* The counters (actually `number' of these). */
121 struct xt_counters counters[0];
122};
123
124#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
125
dcea992a 126#ifndef __KERNEL__
89c002d6
PM
127/* fn returns 0 to continue iteration */
128#define XT_MATCH_ITERATE(type, e, fn, args...) \
129({ \
130 unsigned int __i; \
131 int __ret = 0; \
132 struct xt_entry_match *__m; \
133 \
134 for (__i = sizeof(type); \
135 __i < (e)->target_offset; \
136 __i += __m->u.match_size) { \
137 __m = (void *)e + __i; \
138 \
139 __ret = fn(__m , ## args); \
140 if (__ret != 0) \
141 break; \
142 } \
143 __ret; \
144})
145
146/* fn returns 0 to continue iteration */
147#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \
148({ \
149 unsigned int __i, __n; \
150 int __ret = 0; \
151 type *__entry; \
152 \
153 for (__i = 0, __n = 0; __i < (size); \
154 __i += __entry->next_offset, __n++) { \
155 __entry = (void *)(entries) + __i; \
156 if (__n < n) \
157 continue; \
158 \
159 __ret = fn(__entry , ## args); \
160 if (__ret != 0) \
161 break; \
162 } \
163 __ret; \
164})
165
166/* fn returns 0 to continue iteration */
167#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \
168 XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
169
72b2b1dd
JE
170#endif /* !__KERNEL__ */
171
172/* pos is normally a struct ipt_entry/ip6t_entry/etc. */
173#define xt_entry_foreach(pos, ehead, esize) \
174 for ((pos) = (typeof(pos))(ehead); \
175 (pos) < (typeof(pos))((char *)(ehead) + (esize)); \
176 (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
177
dcea992a
JE
178/* can only be xt_entry_match, so no use of typeof here */
179#define xt_ematch_foreach(pos, entry) \
180 for ((pos) = (struct xt_entry_match *)entry->elems; \
181 (pos) < (struct xt_entry_match *)((char *)(entry) + \
182 (entry)->target_offset); \
183 (pos) = (struct xt_entry_match *)((char *)(pos) + \
184 (pos)->u.match_size))
185
2e4e6a17
HW
186#ifdef __KERNEL__
187
188#include <linux/netdevice.h>
189
f7108a20 190/**
de74c169 191 * struct xt_action_param - parameters for matches/targets
f7108a20 192 *
de74c169
JE
193 * @match: the match extension
194 * @target: the target extension
195 * @matchinfo: per-match data
196 * @targetinfo: per-target data
f7108a20
JE
197 * @in: input netdevice
198 * @out: output netdevice
f7108a20
JE
199 * @fragoff: packet is a fragment, this is the data offset
200 * @thoff: position of transport header relative to skb->data
a5e78820 201 * @hook: hook number given packet came from
916a917d
JE
202 * @family: Actual NFPROTO_* through which the function is invoked
203 * (helpful when match->family == NFPROTO_UNSPEC)
b4ba2611
JE
204 *
205 * Fields written to by extensions:
206 *
a5e78820 207 * @hotdrop: drop packet if we had inspection problems
16599786 208 * Network namespace obtainable using dev_net(in/out)
f7108a20 209 */
de74c169
JE
210struct xt_action_param {
211 union {
212 const struct xt_match *match;
213 const struct xt_target *target;
214 };
215 union {
216 const void *matchinfo, *targinfo;
217 };
f7108a20 218 const struct net_device *in, *out;
f7108a20
JE
219 int fragoff;
220 unsigned int thoff;
a5e78820 221 unsigned int hooknum;
916a917d 222 u_int8_t family;
b4ba2611 223 bool hotdrop;
f7108a20
JE
224};
225
9b4fce7a
JE
226/**
227 * struct xt_mtchk_param - parameters for match extensions'
228 * checkentry functions
229 *
16599786 230 * @net: network namespace through which the check was invoked
9b4fce7a
JE
231 * @table: table the rule is tried to be inserted into
232 * @entryinfo: the family-specific rule data
16599786 233 * (struct ipt_ip, ip6t_ip, arpt_arp or (note) ebt_entry)
9b4fce7a
JE
234 * @match: struct xt_match through which this function was invoked
235 * @matchinfo: per-match data
236 * @hook_mask: via which hooks the new rule is reachable
16599786 237 * Other fields as above.
9b4fce7a
JE
238 */
239struct xt_mtchk_param {
a83d8e8d 240 struct net *net;
9b4fce7a
JE
241 const char *table;
242 const void *entryinfo;
243 const struct xt_match *match;
244 void *matchinfo;
245 unsigned int hook_mask;
916a917d 246 u_int8_t family;
9b4fce7a
JE
247};
248
16599786
JE
249/**
250 * struct xt_mdtor_param - match destructor parameters
251 * Fields as above.
252 */
6be3d859 253struct xt_mtdtor_param {
f54e9367 254 struct net *net;
6be3d859
JE
255 const struct xt_match *match;
256 void *matchinfo;
916a917d 257 u_int8_t family;
6be3d859
JE
258};
259
af5d6dc2
JE
260/**
261 * struct xt_tgchk_param - parameters for target extensions'
262 * checkentry functions
263 *
264 * @entryinfo: the family-specific rule data
265 * (struct ipt_entry, ip6t_entry, arpt_entry, ebt_entry)
266 *
267 * Other fields see above.
268 */
269struct xt_tgchk_param {
add67461 270 struct net *net;
af5d6dc2 271 const char *table;
f79fca55 272 const void *entryinfo;
af5d6dc2
JE
273 const struct xt_target *target;
274 void *targinfo;
275 unsigned int hook_mask;
916a917d 276 u_int8_t family;
af5d6dc2
JE
277};
278
a2df1648
JE
279/* Target destructor parameters */
280struct xt_tgdtor_param {
add67461 281 struct net *net;
a2df1648
JE
282 const struct xt_target *target;
283 void *targinfo;
916a917d 284 u_int8_t family;
a2df1648
JE
285};
286
d94d9fee 287struct xt_match {
2e4e6a17
HW
288 struct list_head list;
289
4b2cbd42 290 const char name[XT_EXTENSION_MAXNAMELEN];
daaf83d2 291 u_int8_t revision;
2e4e6a17 292
2e4e6a17
HW
293 /* Return true or false: return FALSE and set *hotdrop = 1 to
294 force immediate packet drop. */
295 /* Arguments changed since 2.6.9, as this must now handle
296 non-linear skb, using skb_header_pointer and
297 skb_ip_make_writable. */
1d93a9cb 298 bool (*match)(const struct sk_buff *skb,
62fc8051 299 struct xt_action_param *);
2e4e6a17
HW
300
301 /* Called when user tries to insert an entry of this type. */
b0f38452 302 int (*checkentry)(const struct xt_mtchk_param *);
2e4e6a17
HW
303
304 /* Called when entry of this type deleted. */
6be3d859 305 void (*destroy)(const struct xt_mtdtor_param *);
c30f540b 306#ifdef CONFIG_COMPAT
2722971c 307 /* Called when userspace align differs from kernel space one */
739674fb
JE
308 void (*compat_from_user)(void *dst, const void *src);
309 int (*compat_to_user)(void __user *dst, const void *src);
c30f540b 310#endif
2e4e6a17
HW
311 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
312 struct module *me;
37f9f733 313
ecb6f85e 314 const char *table;
37f9f733 315 unsigned int matchsize;
c30f540b 316#ifdef CONFIG_COMPAT
9fa492cd 317 unsigned int compatsize;
c30f540b 318#endif
37f9f733
PM
319 unsigned int hooks;
320 unsigned short proto;
c4b88513
PM
321
322 unsigned short family;
2e4e6a17
HW
323};
324
325/* Registration hooks for targets. */
d94d9fee 326struct xt_target {
2e4e6a17
HW
327 struct list_head list;
328
4b2cbd42 329 const char name[XT_EXTENSION_MAXNAMELEN];
f5c511c6 330 u_int8_t revision;
2e4e6a17 331
2e4e6a17
HW
332 /* Returns verdict. Argument order changed since 2.6.9, as this
333 must now handle non-linear skbs, using skb_copy_bits and
334 skb_ip_make_writable. */
3db05fea 335 unsigned int (*target)(struct sk_buff *skb,
de74c169 336 const struct xt_action_param *);
2e4e6a17
HW
337
338 /* Called when user tries to insert an entry of this type:
339 hook_mask is a bitmask of hooks from which it can be
340 called. */
7ea7b858 341 /* Should return 0 on success or an error code otherwise (-Exxxx). */
135367b8 342 int (*checkentry)(const struct xt_tgchk_param *);
2e4e6a17
HW
343
344 /* Called when entry of this type deleted. */
a2df1648 345 void (*destroy)(const struct xt_tgdtor_param *);
c30f540b 346#ifdef CONFIG_COMPAT
2722971c 347 /* Called when userspace align differs from kernel space one */
739674fb
JE
348 void (*compat_from_user)(void *dst, const void *src);
349 int (*compat_to_user)(void __user *dst, const void *src);
c30f540b 350#endif
2e4e6a17
HW
351 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
352 struct module *me;
37f9f733 353
ecb6f85e 354 const char *table;
37f9f733 355 unsigned int targetsize;
c30f540b 356#ifdef CONFIG_COMPAT
9fa492cd 357 unsigned int compatsize;
c30f540b 358#endif
37f9f733
PM
359 unsigned int hooks;
360 unsigned short proto;
c4b88513
PM
361
362 unsigned short family;
2e4e6a17
HW
363};
364
365/* Furniture shopping... */
d94d9fee 366struct xt_table {
2e4e6a17
HW
367 struct list_head list;
368
2e4e6a17
HW
369 /* What hooks you will enter on */
370 unsigned int valid_hooks;
371
2e4e6a17 372 /* Man behind the curtain... */
4a2f965c 373 struct xt_table_info *private;
2e4e6a17
HW
374
375 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
376 struct module *me;
377
76108cea 378 u_int8_t af; /* address/protocol family */
2b95efe7 379 int priority; /* hook order */
4a2f965c
SH
380
381 /* A unique name... */
382 const char name[XT_TABLE_MAXNAMELEN];
2e4e6a17
HW
383};
384
385#include <linux/netfilter_ipv4.h>
386
387/* The table itself */
d94d9fee 388struct xt_table_info {
2e4e6a17
HW
389 /* Size per table */
390 unsigned int size;
391 /* Number of entries: FIXME. --RR */
392 unsigned int number;
393 /* Initial number of entries. Needed for module usage count */
394 unsigned int initial_entries;
395
396 /* Entry points and underflows */
6e23ae2a
PM
397 unsigned int hook_entry[NF_INET_NUMHOOKS];
398 unsigned int underflow[NF_INET_NUMHOOKS];
2e4e6a17 399
f3c5c1bf
JE
400 /*
401 * Number of user chains. Since tables cannot have loops, at most
402 * @stacksize jumps (number of user chains) can possibly be made.
403 */
404 unsigned int stacksize;
7489aec8 405 unsigned int __percpu *stackptr;
f3c5c1bf 406 void ***jumpstack;
2e4e6a17 407 /* ipt_entry tables: one per CPU */
259d4e41 408 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
78454473 409 void *entries[1];
2e4e6a17
HW
410};
411
259d4e41
ED
412#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
413 + nr_cpu_ids * sizeof(char *))
a45049c5
PNA
414extern int xt_register_target(struct xt_target *target);
415extern void xt_unregister_target(struct xt_target *target);
52d9c42e
PM
416extern int xt_register_targets(struct xt_target *target, unsigned int n);
417extern void xt_unregister_targets(struct xt_target *target, unsigned int n);
418
a45049c5
PNA
419extern int xt_register_match(struct xt_match *target);
420extern void xt_unregister_match(struct xt_match *target);
52d9c42e
PM
421extern int xt_register_matches(struct xt_match *match, unsigned int n);
422extern void xt_unregister_matches(struct xt_match *match, unsigned int n);
2e4e6a17 423
916a917d 424extern int xt_check_match(struct xt_mtchk_param *,
9b4fce7a 425 unsigned int size, u_int8_t proto, bool inv_proto);
916a917d 426extern int xt_check_target(struct xt_tgchk_param *,
af5d6dc2 427 unsigned int size, u_int8_t proto, bool inv_proto);
37f9f733 428
8d870052 429extern struct xt_table *xt_register_table(struct net *net,
35aad0ff 430 const struct xt_table *table,
a98da11d
AD
431 struct xt_table_info *bootstrap,
432 struct xt_table_info *newinfo);
2e4e6a17
HW
433extern void *xt_unregister_table(struct xt_table *table);
434
435extern struct xt_table_info *xt_replace_table(struct xt_table *table,
436 unsigned int num_counters,
437 struct xt_table_info *newinfo,
438 int *error);
439
76108cea
JE
440extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
441extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
fd0ec0e6
JE
442extern struct xt_match *xt_request_find_match(u8 af, const char *name,
443 u8 revision);
76108cea 444extern struct xt_target *xt_request_find_target(u8 af, const char *name,
2e4e6a17 445 u8 revision);
76108cea
JE
446extern int xt_find_revision(u8 af, const char *name, u8 revision,
447 int target, int *err);
2e4e6a17 448
76108cea 449extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
8d870052 450 const char *name);
2e4e6a17
HW
451extern void xt_table_unlock(struct xt_table *t);
452
76108cea
JE
453extern int xt_proto_init(struct net *net, u_int8_t af);
454extern void xt_proto_fini(struct net *net, u_int8_t af);
2e4e6a17
HW
455
456extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
457extern void xt_free_table_info(struct xt_table_info *info);
942e4a2b
SH
458
459/*
460 * Per-CPU spinlock associated with per-cpu table entries, and
461 * with a counter for the "reading" side that allows a recursive
462 * reader to avoid taking the lock and deadlocking.
463 *
464 * "reading" is used by ip/arp/ip6 tables rule processing which runs per-cpu.
465 * It needs to ensure that the rules are not being changed while the packet
466 * is being processed. In some cases, the read lock will be acquired
467 * twice on the same CPU; this is okay because of the count.
468 *
469 * "writing" is used when reading counters.
470 * During replace any readers that are using the old tables have to complete
471 * before freeing the old table. This is handled by the write locking
472 * necessary for reading the counters.
473 */
474struct xt_info_lock {
475 spinlock_t lock;
476 unsigned char readers;
477};
478DECLARE_PER_CPU(struct xt_info_lock, xt_info_locks);
479
480/*
481 * Note: we need to ensure that preemption is disabled before acquiring
482 * the per-cpu-variable, so we do it as a two step process rather than
483 * using "spin_lock_bh()".
484 *
485 * We _also_ need to disable bottom half processing before updating our
486 * nesting count, to make sure that the only kind of re-entrancy is this
487 * code being called by itself: since the count+lock is not an atomic
488 * operation, we can allow no races.
489 *
490 * _Only_ that special combination of being per-cpu and never getting
491 * re-entered asynchronously means that the count is safe.
492 */
493static inline void xt_info_rdlock_bh(void)
494{
495 struct xt_info_lock *lock;
496
497 local_bh_disable();
498 lock = &__get_cpu_var(xt_info_locks);
0f3d042e 499 if (likely(!lock->readers++))
942e4a2b
SH
500 spin_lock(&lock->lock);
501}
502
503static inline void xt_info_rdunlock_bh(void)
504{
505 struct xt_info_lock *lock = &__get_cpu_var(xt_info_locks);
506
0f3d042e 507 if (likely(!--lock->readers))
942e4a2b
SH
508 spin_unlock(&lock->lock);
509 local_bh_enable();
510}
511
512/*
513 * The "writer" side needs to get exclusive access to the lock,
514 * regardless of readers. This must be called with bottom half
515 * processing (and thus also preemption) disabled.
516 */
517static inline void xt_info_wrlock(unsigned int cpu)
518{
519 spin_lock(&per_cpu(xt_info_locks, cpu).lock);
520}
521
522static inline void xt_info_wrunlock(unsigned int cpu)
523{
524 spin_unlock(&per_cpu(xt_info_locks, cpu).lock);
525}
2e4e6a17 526
b8dfe498
ED
527/*
528 * This helper is performance critical and must be inlined
529 */
530static inline unsigned long ifname_compare_aligned(const char *_a,
531 const char *_b,
532 const char *_mask)
533{
534 const unsigned long *a = (const unsigned long *)_a;
535 const unsigned long *b = (const unsigned long *)_b;
536 const unsigned long *mask = (const unsigned long *)_mask;
537 unsigned long ret;
538
539 ret = (a[0] ^ b[0]) & mask[0];
540 if (IFNAMSIZ > sizeof(unsigned long))
541 ret |= (a[1] ^ b[1]) & mask[1];
542 if (IFNAMSIZ > 2 * sizeof(unsigned long))
543 ret |= (a[2] ^ b[2]) & mask[2];
544 if (IFNAMSIZ > 3 * sizeof(unsigned long))
545 ret |= (a[3] ^ b[3]) & mask[3];
546 BUILD_BUG_ON(IFNAMSIZ > 4 * sizeof(unsigned long));
547 return ret;
548}
549
2b95efe7
JE
550extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *);
551extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *);
552
2722971c
DM
553#ifdef CONFIG_COMPAT
554#include <net/compat.h>
555
d94d9fee 556struct compat_xt_entry_match {
2722971c
DM
557 union {
558 struct {
559 u_int16_t match_size;
560 char name[XT_FUNCTION_MAXNAMELEN - 1];
561 u_int8_t revision;
562 } user;
46c5ea3c
PM
563 struct {
564 u_int16_t match_size;
565 compat_uptr_t match;
566 } kernel;
2722971c
DM
567 u_int16_t match_size;
568 } u;
569 unsigned char data[0];
570};
571
d94d9fee 572struct compat_xt_entry_target {
2722971c
DM
573 union {
574 struct {
575 u_int16_t target_size;
576 char name[XT_FUNCTION_MAXNAMELEN - 1];
577 u_int8_t revision;
578 } user;
46c5ea3c
PM
579 struct {
580 u_int16_t target_size;
581 compat_uptr_t target;
582 } kernel;
2722971c
DM
583 u_int16_t target_size;
584 } u;
585 unsigned char data[0];
586};
587
588/* FIXME: this works only on 32 bit tasks
589 * need to change whole approach in order to calculate align as function of
590 * current task alignment */
591
d94d9fee 592struct compat_xt_counters {
0a026046 593 compat_u64 pcnt, bcnt; /* Packet and byte counters */
2722971c
DM
594};
595
d94d9fee 596struct compat_xt_counters_info {
2722971c
DM
597 char name[XT_TABLE_MAXNAMELEN];
598 compat_uint_t num_counters;
599 struct compat_xt_counters counters[0];
600};
601
42107f50
AD
602struct _compat_xt_align {
603 __u8 u8;
604 __u16 u16;
605 __u32 u32;
606 compat_u64 u64;
607};
608
a79ff731 609#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align))
2722971c 610
76108cea
JE
611extern void xt_compat_lock(u_int8_t af);
612extern void xt_compat_unlock(u_int8_t af);
9fa492cd 613
76108cea
JE
614extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta);
615extern void xt_compat_flush_offsets(u_int8_t af);
3e5e524f 616extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
b386d9f5 617
5452e425 618extern int xt_compat_match_offset(const struct xt_match *match);
89566951 619extern int xt_compat_match_from_user(struct xt_entry_match *m,
b0a6363c 620 void **dstptr, unsigned int *size);
739674fb 621extern int xt_compat_match_to_user(const struct xt_entry_match *m,
b0a6363c 622 void __user **dstptr, unsigned int *size);
9fa492cd 623
5452e425 624extern int xt_compat_target_offset(const struct xt_target *target);
9fa492cd 625extern void xt_compat_target_from_user(struct xt_entry_target *t,
b0a6363c 626 void **dstptr, unsigned int *size);
739674fb 627extern int xt_compat_target_to_user(const struct xt_entry_target *t,
b0a6363c 628 void __user **dstptr, unsigned int *size);
2722971c
DM
629
630#endif /* CONFIG_COMPAT */
2e4e6a17
HW
631#endif /* __KERNEL__ */
632
633#endif /* _X_TABLES_H */