Home | History | Annotate | Download | only in netfilter
      1 #ifndef _NF_NAT_H
      2 #define _NF_NAT_H
      3 #include <linux/netfilter_ipv4.h>
      4 #include <net/netfilter/nf_conntrack_tuple.h>
      5 
      6 #define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16
      7 
      8 enum nf_nat_manip_type
      9 {
     10 	IP_NAT_MANIP_SRC,
     11 	IP_NAT_MANIP_DST
     12 };
     13 
     14 /* SRC manip occurs POST_ROUTING or LOCAL_IN */
     15 #define HOOK2MANIP(hooknum) ((hooknum) != NF_INET_POST_ROUTING && \
     16 			     (hooknum) != NF_INET_LOCAL_IN)
     17 
     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
     22 
     23 /* NAT sequence number modifications */
     24 struct nf_nat_seq {
     25 	/* position of the last TCP sequence number modification (if any) */
     26 	u_int32_t correction_pos;
     27 
     28 	/* sequence number offset before and after last modification */
     29 	int16_t offset_before, offset_after;
     30 };
     31 
     32 /* Single range specification. */
     33 struct nf_nat_range
     34 {
     35 	/* Set to OR of flags above. */
     36 	unsigned int flags;
     37 
     38 	/* Inclusive: network order. */
     39 	__be32 min_ip, max_ip;
     40 
     41 	/* Inclusive: network order */
     42 	union nf_conntrack_man_proto min, max;
     43 };
     44 
     45 /* For backwards compat: don't use in modern code. */
     46 struct nf_nat_multi_range_compat
     47 {
     48 	unsigned int rangesize; /* Must be 1. */
     49 
     50 	/* hangs off end. */
     51 	struct nf_nat_range range[1];
     52 };
     53 
     54 #define nf_nat_multi_range nf_nat_multi_range_compat
     55 #endif
     56