Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Dec 2018 12:15:52 +0000
From:      bugzilla-noreply@freebsd.org
To:        net@FreeBSD.org
Subject:   [Bug 210726] tcp connect() can return invalid EADDRINUSE
Message-ID:  <bug-210726-7501-0qyZBGvYcs@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-210726-7501@https.bugs.freebsd.org/bugzilla/>
References:  <bug-210726-7501@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210726

--- Comment #16 from aler@playground.ru ---
(In reply to Bjoern A. Zeeb from comment #14)

> trying to summarise to get the exact case right as the suggested patch looks not quite right

I don't understand what's wrong with the patch.

> There are too many (corner) cases to consider.

All of them are covered by that single check: busy ports should be detected by
system-wide used ports list, not jailed used ports list.

> In each jail a program tries to establish a connection and has bound a local source address or not, but must not have bound a local port number.

Yes.

> On connect() to a local or remote address and port there may be a case that two applications in two different jails get an implicit bind to the same local port number out of which one succeeds and one fails?  So one connect call succeeds and one fails?

No. Second implicit bind fails itself (searching "non-busy" port - found
actually busy port - try to bind - fail) and throws a error through connect()
that tried it.


> It is not yet fully understood if the same could possibly happen between the base system and a jail, in which case it is assumed that the connect() inside the jail would be the one always failing?

Yes, it can, when the implicit bind happens in jail. Already busy port can be
anywhere outside that jail, so it may be in other jail on in host system.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-210726-7501-0qyZBGvYcs>