Commit c3924c70 authored by Folkert van Heusden's avatar Folkert van Heusden Committed by David S. Miller

[TCP]: Optimize check in port-allocation code, v6 version.

Signed-off-by: default avatarFolkert van Heusden <folkert@vanheusden.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0b2531bd
...@@ -139,9 +139,12 @@ static int tcp_v6_get_port(struct sock *sk, unsigned short snum) ...@@ -139,9 +139,12 @@ static int tcp_v6_get_port(struct sock *sk, unsigned short snum)
int rover; int rover;
spin_lock(&tcp_portalloc_lock); spin_lock(&tcp_portalloc_lock);
rover = tcp_port_rover; if (tcp_port_rover < low)
rover = low;
else
rover = tcp_port_rover;
do { rover++; do { rover++;
if ((rover < low) || (rover > high)) if (rover > high)
rover = low; rover = low;
head = &tcp_bhash[tcp_bhashfn(rover)]; head = &tcp_bhash[tcp_bhashfn(rover)];
spin_lock(&head->lock); spin_lock(&head->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment