1 /* SPDX-License-Identifier: GPL-2.0 */
3 * 25-Jul-1998 Major changes to allow for ip chain table
5 * 3-Jan-2000 Named tables to allow packet selection for different uses.
9 * Format of an IP firewall descriptor
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.
21 #include <linux/skbuff.h>
23 #include <linux/init.h>
24 #include <uapi/linux/netfilter_ipv4/ip_tables.h>
26 extern void ipt_init(void) __init;
28 int ipt_register_table(struct net *net, const struct xt_table *table,
29 const struct ipt_replace *repl,
30 const struct nf_hook_ops *ops, struct xt_table **res);
31 void ipt_unregister_table(struct net *net, struct xt_table *table,
32 const struct nf_hook_ops *ops);
36 struct ipt_entry entry;
37 struct xt_standard_target target;
41 struct ipt_entry entry;
42 struct xt_error_target target;
45 #define IPT_ENTRY_INIT(__size) \
47 .target_offset = sizeof(struct ipt_entry), \
48 .next_offset = (__size), \
51 #define IPT_STANDARD_INIT(__verdict) \
53 .entry = IPT_ENTRY_INIT(sizeof(struct ipt_standard)), \
54 .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \
55 sizeof(struct xt_standard_target)), \
56 .target.verdict = -(__verdict) - 1, \
59 #define IPT_ERROR_INIT \
61 .entry = IPT_ENTRY_INIT(sizeof(struct ipt_error)), \
62 .target = XT_TARGET_INIT(XT_ERROR_TARGET, \
63 sizeof(struct xt_error_target)), \
64 .target.errorname = "ERROR", \
67 extern void *ipt_alloc_initial_table(const struct xt_table *);
68 extern unsigned int ipt_do_table(struct sk_buff *skb,
69 const struct nf_hook_state *state,
70 struct xt_table *table);
73 #include <net/compat.h>
75 struct compat_ipt_entry {
77 compat_uint_t nfcache;
80 compat_uint_t comefrom;
81 struct compat_xt_counters counters;
82 unsigned char elems[0];
85 /* Helper functions */
86 static inline struct xt_entry_target *
87 compat_ipt_get_target(struct compat_ipt_entry *e)
89 return (void *)e + e->target_offset;
92 #endif /* CONFIG_COMPAT */
93 #endif /* _IPTABLES_H */