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_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN)
17 #define IP_NAT_RANGE_MAP_IPS 1
18 #define IP_NAT_RANGE_PROTO_SPECIFIED 2
19 #define IP_NAT_RANGE_PROTO_RANDOM 4
21 /* NAT sequence number modifications */
23 /* position of the last TCP sequence number modification (if any) */
24 u_int32_t correction_pos
;
26 /* sequence number offset before and after last modification */
27 int16_t offset_before
, offset_after
;
30 /* Single range specification. */
33 /* Set to OR of flags above. */
36 /* Inclusive: network order. */
37 __be32 min_ip
, max_ip
;
39 /* Inclusive: network order */
40 union nf_conntrack_man_proto min
, max
;
43 /* For backwards compat: don't use in modern code. */
44 struct nf_nat_multi_range_compat
46 unsigned int rangesize
; /* Must be 1. */
49 struct nf_nat_range range
[1];
53 #include <linux/list.h>
54 #include <linux/netfilter/nf_conntrack_pptp.h>
55 #include <net/netfilter/nf_conntrack_extend.h>
57 /* per conntrack: nat application helper private data */
58 union nf_conntrack_nat_help
60 /* insert nat helper private data here */
61 struct nf_nat_pptp nat_pptp_info
;
66 /* The structure embedded in the conntrack structure. */
69 struct hlist_node bysource
;
70 struct nf_nat_seq seq
[IP_CT_DIR_MAX
];
72 union nf_conntrack_nat_help help
;
73 #if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
74 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
79 /* Set up the info structure to map into this range. */
80 extern unsigned int nf_nat_setup_info(struct nf_conn
*ct
,
81 const struct nf_nat_range
*range
,
82 unsigned int hooknum
);
84 /* Is this tuple already taken? (not by us)*/
85 extern int nf_nat_used_tuple(const struct nf_conntrack_tuple
*tuple
,
86 const struct nf_conn
*ignored_conntrack
);
88 static inline struct nf_conn_nat
*nfct_nat(const struct nf_conn
*ct
)
90 return nf_ct_ext_find(ct
, NF_CT_EXT_NAT
);
93 #else /* !__KERNEL__: iptables wants this to compile. */
94 #define nf_nat_multi_range nf_nat_multi_range_compat