1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Format of an ARP firewall descriptor
5 * src, tgt, src_mask, tgt_mask, arpop, arpop_mask are always stored in
7 * flags are stored in host byte order (of course).
14 #include <linux/if_arp.h>
15 #include <linux/skbuff.h>
16 #include <uapi/linux/netfilter_arp/arp_tables.h>
19 struct arpt_standard
{
20 struct arpt_entry entry
;
21 struct xt_standard_target target
;
25 struct arpt_entry entry
;
26 struct xt_error_target target
;
29 #define ARPT_ENTRY_INIT(__size) \
31 .target_offset = sizeof(struct arpt_entry), \
32 .next_offset = (__size), \
35 #define ARPT_STANDARD_INIT(__verdict) \
37 .entry = ARPT_ENTRY_INIT(sizeof(struct arpt_standard)), \
38 .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \
39 sizeof(struct xt_standard_target)), \
40 .target.verdict = -(__verdict) - 1, \
43 #define ARPT_ERROR_INIT \
45 .entry = ARPT_ENTRY_INIT(sizeof(struct arpt_error)), \
46 .target = XT_TARGET_INIT(XT_ERROR_TARGET, \
47 sizeof(struct xt_error_target)), \
48 .target.errorname = "ERROR", \
51 extern void *arpt_alloc_initial_table(const struct xt_table
*);
52 int arpt_register_table(struct net
*net
, const struct xt_table
*table
,
53 const struct arpt_replace
*repl
,
54 const struct nf_hook_ops
*ops
, struct xt_table
**res
);
55 void arpt_unregister_table(struct net
*net
, struct xt_table
*table
,
56 const struct nf_hook_ops
*ops
);
57 extern unsigned int arpt_do_table(struct sk_buff
*skb
,
58 const struct nf_hook_state
*state
,
59 struct xt_table
*table
);
62 #include <net/compat.h>
64 struct compat_arpt_entry
{
68 compat_uint_t comefrom
;
69 struct compat_xt_counters counters
;
70 unsigned char elems
[0];
73 static inline struct xt_entry_target
*
74 compat_arpt_get_target(struct compat_arpt_entry
*e
)
76 return (void *)e
+ e
->target_offset
;
79 #endif /* CONFIG_COMPAT */
80 #endif /* _ARPTABLES_H */