]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/linux/netfilter_arp/arp_tables.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
[mirror_ubuntu-artful-kernel.git] / include / linux / netfilter_arp / arp_tables.h
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 */
8 #ifndef _ARPTABLES_H
9 #define _ARPTABLES_H
10
11 #include <linux/if.h>
12 #include <linux/in.h>
13 #include <linux/if_arp.h>
14 #include <linux/skbuff.h>
15 #include <uapi/linux/netfilter_arp/arp_tables.h>
16
17 /* Standard entry. */
18 struct arpt_standard {
19 struct arpt_entry entry;
20 struct xt_standard_target target;
21 };
22
23 struct arpt_error {
24 struct arpt_entry entry;
25 struct xt_error_target target;
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)), \
37 .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \
38 sizeof(struct xt_standard_target)), \
39 .target.verdict = -(__verdict) - 1, \
40 }
41
42 #define ARPT_ERROR_INIT \
43 { \
44 .entry = ARPT_ENTRY_INIT(sizeof(struct arpt_error)), \
45 .target = XT_TARGET_INIT(XT_ERROR_TARGET, \
46 sizeof(struct xt_error_target)), \
47 .target.errorname = "ERROR", \
48 }
49
50 extern void *arpt_alloc_initial_table(const struct xt_table *);
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);
56 extern unsigned int arpt_do_table(struct sk_buff *skb,
57 const struct nf_hook_state *state,
58 struct xt_table *table);
59
60 #ifdef CONFIG_COMPAT
61 #include <net/compat.h>
62
63 struct compat_arpt_entry {
64 struct arpt_arp arp;
65 __u16 target_offset;
66 __u16 next_offset;
67 compat_uint_t comefrom;
68 struct compat_xt_counters counters;
69 unsigned char elems[0];
70 };
71
72 static inline struct xt_entry_target *
73 compat_arpt_get_target(struct compat_arpt_entry *e)
74 {
75 return (void *)e + e->target_offset;
76 }
77
78 #endif /* CONFIG_COMPAT */
79 #endif /* _ARPTABLES_H */