diff mbox

[net-next] tcp: ipv6: bind() use stronger condition for bind_conflict

Message ID 1362507061-22475-1-git-send-email-fbl@redhat.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Flavio Leitner March 5, 2013, 6:11 p.m. UTC
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 aacd9289af8b82f5fb01bcdd53d0e3406d1333c7
for IPv6.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
---
 net/ipv6/inet6_connection_sock.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

David Miller March 6, 2013, 4:54 a.m. UTC | #1
From: Flavio Leitner <fbl@redhat.com>
Date: Tue,  5 Mar 2013 15:11:01 -0300

> 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 aacd9289af8b82f5fb01bcdd53d0e3406d1333c7
> for IPv6.
> 
> Signed-off-by: Flavio Leitner <fbl@redhat.com>

I think this is 'net' material, therefore that's will I will apply
this, thanks Flavio.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index b386a2c..f7f49bf 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -55,6 +55,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;
 		}
 	}