Subject: bind() should not return -EADDRINUSE

From: Phillip Susi <[email-masked]>
Date: Thu, 11 Dec 2014 14:19:11 -0500

Attempting to establish a connection to a remote host using the same
local port, but a different remote port as the previous connection (
that is still in TIME_WAIT ) results in bind() returning -EADDRINUSE.
 By changing the remote port, you avoid the conflict with the other
connection that is in TIME_WAIT, but since the remote port is not
known when bind() is called, it incorrectly returns -EADDRINUSE.  This
check should not be done in bind(), but deferred until the remote port
is known in the call to connect(), or listen().