diff options
author | Paul Mackerras <paulus@samba.org> | 2005-11-07 19:14:20 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-11-07 19:14:20 -0500 |
commit | 24bfb00123e82a2e70bd115277d922438813515b (patch) | |
tree | 27328b8a5718e16d64e2d101f4b7ddcad5930aed /net/ipv4/inet_connection_sock.c | |
parent | c6135234550ed89a6fd0e8cb229633967e41d649 (diff) | |
parent | 3f00d3e8fb963968a922d821a9a53b503b687e81 (diff) |
Merge ../linux-2.6
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 94468a76c5b4..3fe021f1a566 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -78,17 +78,9 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo, | |||
78 | int low = sysctl_local_port_range[0]; | 78 | int low = sysctl_local_port_range[0]; |
79 | int high = sysctl_local_port_range[1]; | 79 | int high = sysctl_local_port_range[1]; |
80 | int remaining = (high - low) + 1; | 80 | int remaining = (high - low) + 1; |
81 | int rover; | 81 | int rover = net_random() % (high - low) + low; |
82 | 82 | ||
83 | spin_lock(&hashinfo->portalloc_lock); | ||
84 | if (hashinfo->port_rover < low) | ||
85 | rover = low; | ||
86 | else | ||
87 | rover = hashinfo->port_rover; | ||
88 | do { | 83 | do { |
89 | rover++; | ||
90 | if (rover > high) | ||
91 | rover = low; | ||
92 | head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)]; | 84 | head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)]; |
93 | spin_lock(&head->lock); | 85 | spin_lock(&head->lock); |
94 | inet_bind_bucket_for_each(tb, node, &head->chain) | 86 | inet_bind_bucket_for_each(tb, node, &head->chain) |
@@ -97,9 +89,9 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo, | |||
97 | break; | 89 | break; |
98 | next: | 90 | next: |
99 | spin_unlock(&head->lock); | 91 | spin_unlock(&head->lock); |
92 | if (++rover > high) | ||
93 | rover = low; | ||
100 | } while (--remaining > 0); | 94 | } while (--remaining > 0); |
101 | hashinfo->port_rover = rover; | ||
102 | spin_unlock(&hashinfo->portalloc_lock); | ||
103 | 95 | ||
104 | /* Exhausted local port range during search? It is not | 96 | /* Exhausted local port range during search? It is not |
105 | * possible for us to be holding one of the bind hash | 97 | * possible for us to be holding one of the bind hash |