aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_connection_sock.c
diff options
context:
space:
mode:
authorFlavio Leitner <fbl@redhat.com>2012-01-25 03:34:51 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-25 21:50:43 -0500
commit2b05ad33e1e624e7f08b8676d270dc7725403b7e (patch)
tree0f180ef1fa0efcea96738315917eaa014c2ac8f0 /net/ipv4/inet_connection_sock.c
parent68315801dbf3ab2001679fd2074c9dc5dcf87dfa (diff)
tcp: bind() fix autoselection to share ports
The current code checks for conflicts when the application requests a specific port. If there is no conflict, then the request is granted. On the other hand, the port autoselection done by the kernel fails when all ports are bound even when there is a port with no conflict available. The fix changes port autoselection to check if there is a conflict and use it if not. Signed-off-by: Flavio Leitner <fbl@redhat.com> Signed-off-by: Marcelo Ricardo Leitner <mleitner@redhat.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r--net/ipv4/inet_connection_sock.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 2e4e24476c4c..ecd19b5a7ee2 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -128,6 +128,11 @@ again:
128 goto have_snum; 128 goto have_snum;
129 } 129 }
130 } 130 }
131 if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
132 spin_unlock(&head->lock);
133 snum = rover;
134 goto have_snum;
135 }
131 goto next; 136 goto next;
132 } 137 }
133 break; 138 break;