Re: [PATCH net] tcp: fix connect() invalid -EADDRNOTAVAIL error

2014-11-19 Thread Eric Dumazet
On Thu, 2014-11-20 at 14:44 +1100, Jonathan Maxwell wrote: > > > Prerequisites for this to happen: > > > 1) The local tcp port range must be exhausted. > > > 2) A process must have called bind() followed by connect() for all > > > local ports. > > > > How the bind() is done exactly ? How SO_REUSEA

Re: [PATCH net] tcp: fix connect() invalid -EADDRNOTAVAIL error

2014-11-19 Thread Eric Dumazet
On Wed, 2014-11-19 at 17:37 +1100, Jon Maxwell wrote: > Prerequisites for this to happen: > 1) The local tcp port range must be exhausted. > 2) A process must have called bind() followed by connect() for all > local ports. How the bind() is done exactly ? How SO_REUSEADDR is used ? > 3) A diffe

[PATCH net] tcp: fix connect() invalid -EADDRNOTAVAIL error

2014-11-18 Thread Jon Maxwell
The connect() routine returns -EADDRNOTAVAIL without doing a 4 tuple check when the hash buckets were previously allocated by bind() and all local ports are used. The bind() routine creates the local port hash buckets in inet_csk_get_port(). Depending on the socket options it sets tb->fastreus