diff options
Diffstat (limited to 'net/ipv6/inet6_hashtables.c')
-rw-r--r-- | net/ipv6/inet6_hashtables.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index ae6b0e7eb488..1c2c27655435 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -254,18 +254,18 @@ int inet6_hash_connect(struct inet_timewait_death_row *death_row, | |||
254 | int ret; | 254 | int ret; |
255 | 255 | ||
256 | if (snum == 0) { | 256 | if (snum == 0) { |
257 | const int low = sysctl_local_port_range[0]; | 257 | int i, port, low, high, remaining; |
258 | const int high = sysctl_local_port_range[1]; | ||
259 | const int range = high - low; | ||
260 | int i, port; | ||
261 | static u32 hint; | 258 | static u32 hint; |
262 | const u32 offset = hint + inet6_sk_port_offset(sk); | 259 | const u32 offset = hint + inet6_sk_port_offset(sk); |
263 | struct hlist_node *node; | 260 | struct hlist_node *node; |
264 | struct inet_timewait_sock *tw = NULL; | 261 | struct inet_timewait_sock *tw = NULL; |
265 | 262 | ||
263 | inet_get_local_port_range(&low, &high); | ||
264 | remaining = high - low; | ||
265 | |||
266 | local_bh_disable(); | 266 | local_bh_disable(); |
267 | for (i = 1; i <= range; i++) { | 267 | for (i = 1; i <= remaining; i++) { |
268 | port = low + (i + offset) % range; | 268 | port = low + (i + offset) % remaining; |
269 | head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; | 269 | head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
270 | spin_lock(&head->lock); | 270 | spin_lock(&head->lock); |
271 | 271 | ||