Tarsnap / spiped

Spiped is a utility for creating symmetrically encrypted and authenticated pipes between socket addresses.
http://www.tarsnap.com/spiped.html
Other
858 stars 56 forks source link

Allow ENOPROTOOPT for SO_REUSEADDR #341

Closed gperciva closed 2 years ago

gperciva commented 2 years ago

Technically, a POSIX-compatible system is not required to allow SO_REUSEADDR for AF_UNIX sockets. GNU/Hurd does not allow that, and AFAIK it is the only operating system to not do so.

My recommendation is to consider merging this after 1.6.2, because there's other commits which are required to work around bugs in GNU/Hurd. (Based on my reading of the POSIX spec, this particular item is not a bug in GNU/Hurd.)

cperciva commented 2 years ago

We should just allow ENOPROTOOPT for any socket types. While AF_UNIX is the only case where it's known to fail, there's no guarantee that it can't happen in other cases; and we don't need to worry about an undetected failure since we would get a failure on bind anyway.

cperciva commented 2 years ago

LGTM. Remove the draft flag?

gperciva commented 2 years ago

Did you want this merged before 1.6.2? I was suggesting that we wait until after, but it's your call.

cperciva commented 2 years ago

I don't see any reason to wait; in particular, returning ENOPROTOOPT here is entirely consistent with POSIX. (And arguably the right thing to do for AF_LOCAL sockets!)