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.
20 #include <linux/init.h>
22 #include <linux/skbuff.h>
23 #include <uapi/linux/netfilter_ipv4/ip_tables.h>
25 int ipt_register_table(struct net *net, const struct xt_table *table,
26 const struct ipt_replace *repl,
27 const struct nf_hook_ops *ops, struct xt_table **res);
28 void ipt_unregister_table(struct net *net, struct xt_table *table,
29 const struct nf_hook_ops *ops);
33 struct ipt_entry entry;
34 struct xt_standard_target target;
38 struct ipt_entry entry;
39 struct xt_error_target target;
42 #define IPT_ENTRY_INIT(__size) \
44 .target_offset = sizeof(struct ipt_entry), \
45 .next_offset = (__size), \
48 #define IPT_STANDARD_INIT(__verdict) \
50 .entry = IPT_ENTRY_INIT(sizeof(struct ipt_standard)), \
51 .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \
52 sizeof(struct xt_standard_target)), \
53 .target.verdict = -(__verdict) - 1, \
56 #define IPT_ERROR_INIT \
58 .entry = IPT_ENTRY_INIT(sizeof(struct ipt_error)), \
59 .target = XT_TARGET_INIT(XT_ERROR_TARGET, \
60 sizeof(struct xt_error_target)), \
61 .target.errorname = "ERROR", \
64 extern void *ipt_alloc_initial_table(const struct xt_table *);
65 extern unsigned int ipt_do_table(struct sk_buff *skb,
66 const struct nf_hook_state *state,
67 struct xt_table *table);
70 #include <net/compat.h>
72 struct compat_ipt_entry {
74 compat_uint_t nfcache;
77 compat_uint_t comefrom;
78 struct compat_xt_counters counters;
79 unsigned char elems[0];
82 /* Helper functions */
83 static inline struct xt_entry_target *
84 compat_ipt_get_target(struct compat_ipt_entry *e)
86 return (void *)e + e->target_offset;
89 #endif /* CONFIG_COMPAT */
90 #endif /* _IPTABLES_H */