146 if (!hlist_empty(&tb->owners)) {
147 if (tb->fastreuse > 0 &&
148 sk->sk_reuse && sk->sk_state != TCP_LISTEN) {
149 goto success;
150 } else {
151 ret = 1;
152 if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb))
153 goto fail_unlock;
154 }
155 }
156tb_not_found:
157 ret = 1;
158 if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep,
159 net, head, snum)) == NULL)
160 goto fail_unlock;
161 if (hlist_empty(&tb->owners)) {
162 if (sk->sk_reuse && sk->sk_state != TCP_LISTEN)
163 tb->fastreuse = 1;
164 else
165 tb->fastreuse = 0;
166 } else if (tb->fastreuse &&
167 (!sk->sk_reuse || sk->sk_state == TCP_LISTEN))
168 tb->fastreuse = 0;
169success:
170 if (!inet_csk(sk)->icsk_bind_hash)
171 inet_bind_hash(sk, tb, snum);
172 WARN_ON(inet_csk(sk)->icsk_bind_hash != tb);
173 ret = 0;
174
175fail_unlock:
176 spin_unlock(&head->lock);
177fail:
178 local_bh_enable();
179 return ret;
180}
181
182EXPORT_SYMBOL_GPL(inet_csk_get_port);
183
184
185
186