Skip to contentSkip to conversation

tcp: ipv6: bind() use stronger condition for bind_conflict

PATCH In review Flavio Leitner 2 participants 2 messages Mar 5, 2013 – Mar 6, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 aacd9289af8b82f5fb01bcdd53d0e3406d1333c7 for IPv6.

---
 net/ipv6/inet6_connection_sock.c | 4 ++++
 1 file changed, 4 insertions(+)
net/ipv6/inet6_connection_sock.c +4 -0
index b386a2c..f7f49bf 100644
@@ -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;
 		}
 	}
 
Signature · 1 line
1.8.1.4
maintainer
#1 lore raw

From: Flavio Leitner <[email protected]>
Date: Tue, 5 Mar 2013 15:11:01 -0300

Quoted 8 lines

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.

I think this is 'net' material, therefore that's will I will apply this, thanks Flavio.