diff options
author | Folkert van Heusden <folkert@vanheusden.com> | 2005-05-03 23:36:45 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-05-03 23:36:45 +0200 |
commit | c3924c70dd3bddc28b99ccd1688bd281bad1a9be (patch) | |
tree | 958922075140cebd55028aa3c04ad2e1f2c0b5b3 /net | |
parent | [TCP]: Optimize check in port-allocation code. (diff) | |
download | linux-c3924c70dd3bddc28b99ccd1688bd281bad1a9be.tar.xz linux-c3924c70dd3bddc28b99ccd1688bd281bad1a9be.zip |
[TCP]: Optimize check in port-allocation code, v6 version.
Signed-off-by: Folkert van Heusden <folkert@vanheusden.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 4760c85e19db..0f69e800a0ad 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -139,9 +139,12 @@ static int tcp_v6_get_port(struct sock *sk, unsigned short snum) int rover; spin_lock(&tcp_portalloc_lock); - rover = tcp_port_rover; + if (tcp_port_rover < low) + rover = low; + else + rover = tcp_port_rover; do { rover++; - if ((rover < low) || (rover > high)) + if (rover > high) rover = low; head = &tcp_bhash[tcp_bhashfn(rover)]; spin_lock(&head->lock); |