aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/ip_nat_proto_udp.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-02-12 22:43:25 -0800
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-02-12 22:43:25 -0800
commitd9bc125caf592b7d081021f32ce5b717efdf70c8 (patch)
tree263b7066ba22ddce21db610c0300f6eaac6f2064 /net/ipv4/netfilter/ip_nat_proto_udp.c
parentNFS: disconnect before retrying NFSv4 requests over TCP (diff)
parentMerge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6 (diff)
downloadlinux-dev-d9bc125caf592b7d081021f32ce5b717efdf70c8.tar.xz
linux-dev-d9bc125caf592b7d081021f32ce5b717efdf70c8.zip
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Conflicts: net/sunrpc/auth_gss/gss_krb5_crypto.c net/sunrpc/auth_gss/gss_spkm3_token.c net/sunrpc/clnt.c Merge with mainline and fix conflicts.
Diffstat (limited to 'net/ipv4/netfilter/ip_nat_proto_udp.c')
-rw-r--r--net/ipv4/netfilter/ip_nat_proto_udp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv4/netfilter/ip_nat_proto_udp.c b/net/ipv4/netfilter/ip_nat_proto_udp.c
index 5ced0877b32f..dfd521672891 100644
--- a/net/ipv4/netfilter/ip_nat_proto_udp.c
+++ b/net/ipv4/netfilter/ip_nat_proto_udp.c
@@ -8,6 +8,7 @@
#include <linux/types.h>
#include <linux/init.h>
+#include <linux/random.h>
#include <linux/netfilter.h>
#include <linux/ip.h>
#include <linux/udp.h>
@@ -74,6 +75,10 @@ udp_unique_tuple(struct ip_conntrack_tuple *tuple,
range_size = ntohs(range->max.udp.port) - min + 1;
}
+ /* Start from random port to avoid prediction */
+ if (range->flags & IP_NAT_RANGE_PROTO_RANDOM)
+ port = net_random();
+
for (i = 0; i < range_size; i++, port++) {
*portptr = htons(min + port % range_size);
if (!ip_nat_used_tuple(tuple, conntrack))