2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Format of an ARP firewall descriptor
|
|
|
|
*
|
|
|
|
* src, tgt, src_mask, tgt_mask, arpop, arpop_mask are always stored in
|
|
|
|
* network byte order.
|
|
|
|
* flags are stored in host byte order (of course).
|
|
|
|
*/
|
|
|
|
#ifndef _ARPTABLES_H
|
|
|
|
#define _ARPTABLES_H
|
|
|
|
|
|
|
|
#include <linux/if.h>
|
|
|
|
#include <linux/in.h>
|
|
|
|
#include <linux/if_arp.h>
|
|
|
|
#include <linux/skbuff.h>
|
2012-10-09 08:48:56 +00:00
|
|
|
#include <uapi/linux/netfilter_arp/arp_tables.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-05-10 21:14:16 +00:00
|
|
|
/* Standard entry. */
|
2009-11-04 17:50:58 +00:00
|
|
|
struct arpt_standard {
|
2007-05-10 21:14:16 +00:00
|
|
|
struct arpt_entry entry;
|
2010-10-13 14:11:22 +00:00
|
|
|
struct xt_standard_target target;
|
2007-05-10 21:14:16 +00:00
|
|
|
};
|
|
|
|
|
2009-11-04 17:50:58 +00:00
|
|
|
struct arpt_error {
|
2007-05-10 21:14:16 +00:00
|
|
|
struct arpt_entry entry;
|
2010-10-13 14:37:45 +00:00
|
|
|
struct xt_error_target target;
|
2007-05-10 21:14:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define ARPT_ENTRY_INIT(__size) \
|
|
|
|
{ \
|
|
|
|
.target_offset = sizeof(struct arpt_entry), \
|
|
|
|
.next_offset = (__size), \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ARPT_STANDARD_INIT(__verdict) \
|
|
|
|
{ \
|
|
|
|
.entry = ARPT_ENTRY_INIT(sizeof(struct arpt_standard)), \
|
2010-10-13 14:28:00 +00:00
|
|
|
.target = XT_TARGET_INIT(XT_STANDARD_TARGET, \
|
2010-10-13 14:11:22 +00:00
|
|
|
sizeof(struct xt_standard_target)), \
|
2007-05-10 21:14:16 +00:00
|
|
|
.target.verdict = -(__verdict) - 1, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ARPT_ERROR_INIT \
|
|
|
|
{ \
|
|
|
|
.entry = ARPT_ENTRY_INIT(sizeof(struct arpt_error)), \
|
2010-10-13 14:28:00 +00:00
|
|
|
.target = XT_TARGET_INIT(XT_ERROR_TARGET, \
|
2010-10-13 14:37:45 +00:00
|
|
|
sizeof(struct xt_error_target)), \
|
2007-05-10 21:14:16 +00:00
|
|
|
.target.errorname = "ERROR", \
|
|
|
|
}
|
|
|
|
|
2009-06-17 20:14:54 +00:00
|
|
|
extern void *arpt_alloc_initial_table(const struct xt_table *);
|
2016-02-25 09:08:35 +00:00
|
|
|
int arpt_register_table(struct net *net, const struct xt_table *table,
|
|
|
|
const struct arpt_replace *repl,
|
|
|
|
const struct nf_hook_ops *ops, struct xt_table **res);
|
|
|
|
void arpt_unregister_table(struct net *net, struct xt_table *table,
|
|
|
|
const struct nf_hook_ops *ops);
|
2007-10-15 07:53:15 +00:00
|
|
|
extern unsigned int arpt_do_table(struct sk_buff *skb,
|
2015-04-04 01:18:46 +00:00
|
|
|
const struct nf_hook_state *state,
|
2008-04-14 09:15:43 +00:00
|
|
|
struct xt_table *table);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-12-18 06:26:54 +00:00
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
#include <net/compat.h>
|
|
|
|
|
2009-11-04 17:50:58 +00:00
|
|
|
struct compat_arpt_entry {
|
2007-12-18 06:26:54 +00:00
|
|
|
struct arpt_arp arp;
|
2011-08-24 18:44:57 +00:00
|
|
|
__u16 target_offset;
|
|
|
|
__u16 next_offset;
|
2007-12-18 06:26:54 +00:00
|
|
|
compat_uint_t comefrom;
|
|
|
|
struct compat_xt_counters counters;
|
|
|
|
unsigned char elems[0];
|
|
|
|
};
|
|
|
|
|
2010-10-13 14:11:22 +00:00
|
|
|
static inline struct xt_entry_target *
|
2007-12-18 06:26:54 +00:00
|
|
|
compat_arpt_get_target(struct compat_arpt_entry *e)
|
|
|
|
{
|
|
|
|
return (void *)e + e->target_offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_COMPAT */
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif /* _ARPTABLES_H */
|