Skip to content

Commit

Permalink
tcp: ipv6: bind() use stronger condition for bind_conflict
Browse files Browse the repository at this point in the history
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 <fbl@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Flavio Leitner authored and David S. Miller committed Mar 6, 2013
1 parent fae4f3c commit dd9f319
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/ipv6/inet6_connection_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ int inet6_csk_bind_conflict(const struct sock *sk,
if (ipv6_rcv_saddr_equal(sk, sk2))
break;
}
if (!relax && reuse && sk2->sk_reuse &&
sk2->sk_state != TCP_LISTEN &&
ipv6_rcv_saddr_equal(sk, sk2))
break;
}
}

Expand Down

0 comments on commit dd9f319

Please sign in to comment.