diff options
author | David S. Miller <davem@davemloft.net> | 2010-04-28 14:25:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-28 14:25:59 -0400 |
commit | 8d238b25b1ec22a73b1c2206f111df2faaff8285 (patch) | |
tree | bc0c6da1df80e826f47588744ebfded7f1949a95 | |
parent | eb4fd8cd355c8ec425a12ec6cbdac614e8a4819d (diff) |
Revert "tcp: bind() fix when many ports are bound"
This reverts two commits:
fda48a0d7a8412cedacda46a9c0bf8ef9cd13559
tcp: bind() fix when many ports are bound
and a follow-on fix for it:
6443bb1fc2050ca2b6585a3fa77f7833b55329ed
ipv6: Fix inet6_csk_bind_conflict()
It causes problems with binding listening sockets when time-wait
sockets from a previous instance still are alive.
It's too late to keep fiddling with this so late in the -rc
series, and we'll deal with it in net-next-2.6 instead.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 16 | ||||
-rw-r--r-- | net/ipv6/inet6_connection_sock.c | 15 |
2 files changed, 10 insertions, 21 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 14825eb09770..8da6429269dd 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -70,17 +70,13 @@ int inet_csk_bind_conflict(const struct sock *sk, | |||
70 | (!sk->sk_bound_dev_if || | 70 | (!sk->sk_bound_dev_if || |
71 | !sk2->sk_bound_dev_if || | 71 | !sk2->sk_bound_dev_if || |
72 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { | 72 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { |
73 | const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); | ||
74 | |||
75 | if (!reuse || !sk2->sk_reuse || | 73 | if (!reuse || !sk2->sk_reuse || |
76 | sk2->sk_state == TCP_LISTEN) { | 74 | sk2->sk_state == TCP_LISTEN) { |
75 | const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); | ||
77 | if (!sk2_rcv_saddr || !sk_rcv_saddr || | 76 | if (!sk2_rcv_saddr || !sk_rcv_saddr || |
78 | sk2_rcv_saddr == sk_rcv_saddr) | 77 | sk2_rcv_saddr == sk_rcv_saddr) |
79 | break; | 78 | break; |
80 | } else if (reuse && sk2->sk_reuse && | 79 | } |
81 | sk2_rcv_saddr && | ||
82 | sk2_rcv_saddr == sk_rcv_saddr) | ||
83 | break; | ||
84 | } | 80 | } |
85 | } | 81 | } |
86 | return node != NULL; | 82 | return node != NULL; |
@@ -124,11 +120,9 @@ again: | |||
124 | smallest_size = tb->num_owners; | 120 | smallest_size = tb->num_owners; |
125 | smallest_rover = rover; | 121 | smallest_rover = rover; |
126 | if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) { | 122 | if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) { |
127 | if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) { | 123 | spin_unlock(&head->lock); |
128 | spin_unlock(&head->lock); | 124 | snum = smallest_rover; |
129 | snum = smallest_rover; | 125 | goto have_snum; |
130 | goto have_snum; | ||
131 | } | ||
132 | } | 126 | } |
133 | } | 127 | } |
134 | goto next; | 128 | goto next; |
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 3a4d92b5a83e..628db24bcf22 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -42,16 +42,11 @@ int inet6_csk_bind_conflict(const struct sock *sk, | |||
42 | if (sk != sk2 && | 42 | if (sk != sk2 && |
43 | (!sk->sk_bound_dev_if || | 43 | (!sk->sk_bound_dev_if || |
44 | !sk2->sk_bound_dev_if || | 44 | !sk2->sk_bound_dev_if || |
45 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { | 45 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if) && |
46 | if ((!sk->sk_reuse || !sk2->sk_reuse || | 46 | (!sk->sk_reuse || !sk2->sk_reuse || |
47 | sk2->sk_state == TCP_LISTEN) && | 47 | sk2->sk_state == TCP_LISTEN) && |
48 | ipv6_rcv_saddr_equal(sk, sk2)) | 48 | ipv6_rcv_saddr_equal(sk, sk2)) |
49 | break; | 49 | break; |
50 | else if (sk->sk_reuse && sk2->sk_reuse && | ||
51 | !ipv6_addr_any(inet6_rcv_saddr(sk)) && | ||
52 | ipv6_rcv_saddr_equal(sk, sk2)) | ||
53 | break; | ||
54 | } | ||
55 | } | 50 | } |
56 | 51 | ||
57 | return node != NULL; | 52 | return node != NULL; |