HomeFreeBSD

unix: retire LOCAL_CONNWAIT

Description

unix: retire LOCAL_CONNWAIT

This socket option was added in 6a2989fd54a9 together with LOCAL_CREDS.
Both options originate from NetBSD. The LOCAL_CREDS seems to be used by
some software and is covered by our test suite.

The main problem with LOCAL_CONNWAIT is that it doesn't work as
documented. A basic test shows that connect(2) indeed blocks, but
accept(2) on the other side does not wake it up. Indeed, I don't see what
code in the accept(2) path would go into the peer socket of a unix/stream
listener's child and would make wakeup(&so->so_timeo). I tried the test
even on a FreeBSD 6.4-RELEASE and it produced the same results as on
CURRENT.

The other thing that puzzles me is why that option would be useful even if
it worked? Because on unix/stream you can send(2) immediately after
connect(2) and that would put data on the peer receive buffer even before
listener had done accept(2). In other words, one side can do connect(2)
then send(2), only after the remote side would make accept(2) and the
remote would see the data sent before the accept(2). Again this
undocumented feature of unix(4) is present on all versions from FreeBSD 6
to CURRENT.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D43708

Details

Provenance
glebiusAuthored on Feb 8 2024, 5:00 PM
Reviewer
markj
Differential Revision
D43708: unix: retire LOCAL_CONNWAIT
Parents
rG3ad0f9a58410: tests/unix_passfd: add a comment for send_a_lot
Branches
Unknown
Tags
Unknown