[Bug 210726] tcp connect() can return invalid EADDRINUSE

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Dec 10 12:15:55 UTC 2018


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

--- Comment #16 from aler at 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.


More information about the freebsd-net mailing list