3 #include <linux/netfilter_ipv4.h>
4 #include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
6 #define IP_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
20 /* NAT sequence number modifications */
22 /* position of the last TCP sequence number
23 * modification (if any) */
24 u_int32_t correction_pos;
25 /* sequence number offset before and after last modification */
26 int32_t offset_before, offset_after;
29 /* Single range specification. */
32 /* Set to OR of flags above. */
35 /* Inclusive: network order. */
36 u_int32_t min_ip, max_ip;
38 /* Inclusive: network order */
39 union ip_conntrack_manip_proto min, max;
42 /* For backwards compat: don't use in modern code. */
43 struct ip_nat_multi_range_compat
45 unsigned int rangesize; /* Must be 1. */
48 struct ip_nat_range range[1];
52 #include <linux/list.h>
53 #include <linux/netfilter_ipv4/lockhelp.h>
55 /* Protects NAT hash tables, and NAT-private part of conntracks. */
56 DECLARE_RWLOCK_EXTERN(ip_nat_lock);
58 /* The structure embedded in the conntrack structure. */
61 struct list_head bysource;
63 /* Helper (NULL if none). */
64 struct ip_nat_helper *helper;
66 struct ip_nat_seq seq[IP_CT_DIR_MAX];
71 /* Set up the info structure to map into this range. */
72 extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack,
73 const struct ip_nat_range *range,
74 unsigned int hooknum);
76 /* Is this tuple already taken? (not by us)*/
77 extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple,
78 const struct ip_conntrack *ignored_conntrack);
80 /* Calculate relative checksum. */
81 extern u_int16_t ip_nat_cheat_check(u_int32_t oldvalinv,
84 #else /* !__KERNEL__: iptables wants this to compile. */
85 #define ip_nat_multi_range ip_nat_multi_range_compat