From 237db9f35a7cdc1718583f99edcc8169cc2d9cf5 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Thu, 16 Apr 2009 18:33:01 +0200 Subject: [PATCH] --- yaml --- r: 143859 b: refs/heads/master c: 98d500d66cb7940747b424b245fc6a51ecfbf005 h: refs/heads/master i: 143857: eba22e8a5f325f9c63d6c9afe456e904ac0b41dd 143855: f4217f3c045bf0b1b2cb84f72372d320efec43e2 v: v3 --- [refs] | 2 +- trunk/include/net/netfilter/nf_nat.h | 1 + trunk/net/ipv4/netfilter/nf_nat_core.c | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 0ba4574d498d..1ff554b91ff1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 38fb0afcd8761f8858e27135ed89a65117e2019c +refs/heads/master: 98d500d66cb7940747b424b245fc6a51ecfbf005 diff --git a/trunk/include/net/netfilter/nf_nat.h b/trunk/include/net/netfilter/nf_nat.h index 9dc1039ff78b..8df0b7f7fc6e 100644 --- a/trunk/include/net/netfilter/nf_nat.h +++ b/trunk/include/net/netfilter/nf_nat.h @@ -18,6 +18,7 @@ enum nf_nat_manip_type #define IP_NAT_RANGE_MAP_IPS 1 #define IP_NAT_RANGE_PROTO_SPECIFIED 2 #define IP_NAT_RANGE_PROTO_RANDOM 4 +#define IP_NAT_RANGE_PERSISTENT 8 /* NAT sequence number modifications */ struct nf_nat_seq { diff --git a/trunk/net/ipv4/netfilter/nf_nat_core.c b/trunk/net/ipv4/netfilter/nf_nat_core.c index fe65187810f0..3229e0a81ba6 100644 --- a/trunk/net/ipv4/netfilter/nf_nat_core.c +++ b/trunk/net/ipv4/netfilter/nf_nat_core.c @@ -211,7 +211,8 @@ find_best_ips_proto(struct nf_conntrack_tuple *tuple, minip = ntohl(range->min_ip); maxip = ntohl(range->max_ip); j = jhash_2words((__force u32)tuple->src.u3.ip, - (__force u32)tuple->dst.u3.ip, 0); + range->flags & IP_NAT_RANGE_PERSISTENT ? + (__force u32)tuple->dst.u3.ip : 0, 0); j = ((u64)j * (maxip - minip + 1)) >> 32; *var_ipp = htonl(minip + j); }