1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * 25-Jul-1998 Major changes to allow for ip chain table
4 *
5 * 3-Jan-2000 Named tables to allow packet selection for different uses.
6 */
7
8 /*
9 * Format of an IP6 firewall descriptor
10 *
11 * src, dst, src_mask, dst_mask are always stored in network byte order.
12 * flags are stored in host byte order (of course).
13 * Port numbers are stored in HOST byte order.
14 */
15 #ifndef _IP6_TABLES_H
16 #define _IP6_TABLES_H
17
18 #include <linux/if.h>
19 #include <linux/in6.h>
20 #include <linux/init.h>
21 #include <linux/ipv6.h>
22 #include <linux/skbuff.h>
23 #include <uapi/linux/netfilter_ipv6/ip6_tables.h>
24
25 extern void *ip6t_alloc_initial_table(const struct xt_table *);
26
27 int ip6t_register_table(struct net *net, const struct xt_table *table,
28 const struct ip6t_replace *repl,
29 const struct nf_hook_ops *ops);
30 void ip6t_unregister_table_pre_exit(struct net *net, const char *name);
31 void ip6t_unregister_table_exit(struct net *net, const char *name);
32 extern unsigned int ip6t_do_table(void *priv, struct sk_buff *skb,
33 const struct nf_hook_state *state);
34
35 #ifdef CONFIG_NETFILTER_XTABLES_COMPAT
36 #include <net/compat.h>
37
38 struct compat_ip6t_entry {
39 struct ip6t_ip6 ipv6;
40 compat_uint_t nfcache;
41 __u16 target_offset;
42 __u16 next_offset;
43 compat_uint_t comefrom;
44 struct compat_xt_counters counters;
45 unsigned char elems[];
46 };
47
48 static inline struct xt_entry_target *
compat_ip6t_get_target(struct compat_ip6t_entry * e)49 compat_ip6t_get_target(struct compat_ip6t_entry *e)
50 {
51 return (void *)e + e->target_offset;
52 }
53
54 #endif /* CONFIG_COMPAT */
55 #endif /* _IP6_TABLES_H */
56