]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Format of an ARP firewall descriptor | |
3 | * | |
4 | * src, tgt, src_mask, tgt_mask, arpop, arpop_mask are always stored in | |
5 | * network byte order. | |
6 | * flags are stored in host byte order (of course). | |
7 | */ | |
1da177e4 LT |
8 | #ifndef _ARPTABLES_H |
9 | #define _ARPTABLES_H | |
10 | ||
1da177e4 | 11 | #include <linux/if.h> |
1da177e4 LT |
12 | #include <linux/in.h> |
13 | #include <linux/if_arp.h> | |
14 | #include <linux/skbuff.h> | |
8922082a | 15 | #include <uapi/linux/netfilter_arp/arp_tables.h> |
1da177e4 | 16 | |
3c2ad469 | 17 | /* Standard entry. */ |
d94d9fee | 18 | struct arpt_standard { |
3c2ad469 | 19 | struct arpt_entry entry; |
87a2e70d | 20 | struct xt_standard_target target; |
3c2ad469 PM |
21 | }; |
22 | ||
d94d9fee | 23 | struct arpt_error { |
3c2ad469 | 24 | struct arpt_entry entry; |
75f0a0fd | 25 | struct xt_error_target target; |
3c2ad469 PM |
26 | }; |
27 | ||
28 | #define ARPT_ENTRY_INIT(__size) \ | |
29 | { \ | |
30 | .target_offset = sizeof(struct arpt_entry), \ | |
31 | .next_offset = (__size), \ | |
32 | } | |
33 | ||
34 | #define ARPT_STANDARD_INIT(__verdict) \ | |
35 | { \ | |
36 | .entry = ARPT_ENTRY_INIT(sizeof(struct arpt_standard)), \ | |
243bf6e2 | 37 | .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \ |
87a2e70d | 38 | sizeof(struct xt_standard_target)), \ |
3c2ad469 PM |
39 | .target.verdict = -(__verdict) - 1, \ |
40 | } | |
41 | ||
42 | #define ARPT_ERROR_INIT \ | |
43 | { \ | |
44 | .entry = ARPT_ENTRY_INIT(sizeof(struct arpt_error)), \ | |
243bf6e2 | 45 | .target = XT_TARGET_INIT(XT_ERROR_TARGET, \ |
75f0a0fd | 46 | sizeof(struct xt_error_target)), \ |
3c2ad469 PM |
47 | .target.errorname = "ERROR", \ |
48 | } | |
49 | ||
e3eaa991 | 50 | extern void *arpt_alloc_initial_table(const struct xt_table *); |
a67dd266 FW |
51 | int arpt_register_table(struct net *net, const struct xt_table *table, |
52 | const struct arpt_replace *repl, | |
53 | const struct nf_hook_ops *ops, struct xt_table **res); | |
54 | void arpt_unregister_table(struct net *net, struct xt_table *table, | |
55 | const struct nf_hook_ops *ops); | |
3db05fea | 56 | extern unsigned int arpt_do_table(struct sk_buff *skb, |
b85c3dc9 | 57 | const struct nf_hook_state *state, |
4abff077 | 58 | struct xt_table *table); |
1da177e4 | 59 | |
d6a2ba07 PM |
60 | #ifdef CONFIG_COMPAT |
61 | #include <net/compat.h> | |
62 | ||
d94d9fee | 63 | struct compat_arpt_entry { |
d6a2ba07 | 64 | struct arpt_arp arp; |
7ff30c43 BH |
65 | __u16 target_offset; |
66 | __u16 next_offset; | |
d6a2ba07 PM |
67 | compat_uint_t comefrom; |
68 | struct compat_xt_counters counters; | |
69 | unsigned char elems[0]; | |
70 | }; | |
71 | ||
87a2e70d | 72 | static inline struct xt_entry_target * |
d6a2ba07 PM |
73 | compat_arpt_get_target(struct compat_arpt_entry *e) |
74 | { | |
75 | return (void *)e + e->target_offset; | |
76 | } | |
77 | ||
d6a2ba07 | 78 | #endif /* CONFIG_COMPAT */ |
1da177e4 | 79 | #endif /* _ARPTABLES_H */ |