Skip to content

Commit dd9f319

Browse files
fleitnerdavem330
authored andcommitted
tcp: ipv6: bind() use stronger condition for bind_conflict
We must try harder to get unique (addr, port) pairs when doing port autoselection for sockets with SO_REUSEADDR option set. This is a continuation of commit aacd928 for IPv6. Signed-off-by: Flavio Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fae4f3c commit dd9f319

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/ipv6/inet6_connection_sock.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ int inet6_csk_bind_conflict(const struct sock *sk,
5454
if (ipv6_rcv_saddr_equal(sk, sk2))
5555
break;
5656
}
57+
if (!relax && reuse && sk2->sk_reuse &&
58+
sk2->sk_state != TCP_LISTEN &&
59+
ipv6_rcv_saddr_equal(sk, sk2))
60+
break;
5761
}
5862
}
5963

0 commit comments

Comments
 (0)