Re: defying original 4.3BSD sockets constraint

Gleb Smirnoff <[email protected]>
Newsgroups gmane.os.freebsd.devel.net
Message-ID <[email protected]>
On Sat, Apr 18, 2026 at 08:35:58AM +0200, Michael Tuexen wrote:
M> > https://reviews.freebsd.org/D56489
M> > 
M> > I've been thinking of this for almost a week already and I don't see any cons.
M> > Pros are listed in the review - clean way to improve parallelism of connect(2).
M> > Maybe I am missing something?  Decided to post for a wider audience than just
M> > the reviews.f.o.  Please speak up if you think I am missing something!
M> I think the sequence of bind() operations is not important.
M> 
M> If I understand you correctly, you say bind(specific) after bind(wildcard)
M> is bad, since the instance of bind(specific) is stealing packets.
M> 
M> The same applies (in my view) for bind(wildcard) after bind(specific).
M> If bind(wildcard) succeeds, the caller assumes that it gets all packets,
M> but that is not true.
M> 
M> The only difference is when the "stealer" took action.

I see your point.  With current code the victim would get EADDRINUSE and thus
will learn that a stealer exists.  With my change that would not happen.  Of
course 99% of software set SO_REUSEADDR and thus bypass this check.

-- 
Gleb Smirnoff
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.