3 #include <linux/netfilter_ipv4.h>
4 #include <net/netfilter/nf_conntrack_tuple.h>
6 #define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16
14 /* SRC manip occurs POST_ROUTING or LOCAL_IN */
15 #define HOOK2MANIP(hooknum) ((hooknum) != NF_INET_POST_ROUTING && \
16 (hooknum) != NF_INET_LOCAL_IN)
18 #define IP_NAT_RANGE_MAP_IPS 1
19 #define IP_NAT_RANGE_PROTO_SPECIFIED 2
20 #define IP_NAT_RANGE_PROTO_RANDOM 4
21 #define IP_NAT_RANGE_PERSISTENT 8
23 /* NAT sequence number modifications */
25 /* position of the last TCP sequence number modification (if any) */
26 u_int32_t correction_pos;
28 /* sequence number offset before and after last modification */
29 int16_t offset_before, offset_after;
32 /* Single range specification. */
35 /* Set to OR of flags above. */
38 /* Inclusive: network order. */
39 __be32 min_ip, max_ip;
41 /* Inclusive: network order */
42 union nf_conntrack_man_proto min, max;
45 /* For backwards compat: don't use in modern code. */
46 struct nf_nat_multi_range_compat
48 unsigned int rangesize; /* Must be 1. */
51 struct nf_nat_range range[1];
55 #include <linux/list.h>
56 #include <linux/netfilter/nf_conntrack_pptp.h>
57 #include <net/netfilter/nf_conntrack_extend.h>
59 /* per conntrack: nat application helper private data */
60 union nf_conntrack_nat_help
62 /* insert nat helper private data here */
63 struct nf_nat_pptp nat_pptp_info;
68 /* The structure embedded in the conntrack structure. */
71 struct hlist_node bysource;
72 struct nf_nat_seq seq[IP_CT_DIR_MAX];
74 union nf_conntrack_nat_help help;
75 #if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
76 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
81 /* Set up the info structure to map into this range. */
82 extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
83 const struct nf_nat_range *range,
84 enum nf_nat_manip_type maniptype);
86 /* Is this tuple already taken? (not by us)*/
87 extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
88 const struct nf_conn *ignored_conntrack);
90 static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
92 return nf_ct_ext_find(ct, NF_CT_EXT_NAT);
95 #else /* !__KERNEL__: iptables wants this to compile. */
96 #define nf_nat_multi_range nf_nat_multi_range_compat