Subject: Re: Proposal: socketfrom()
To: NetBSD Networking Technical Discussion List <>
From: Thor Lancelot Simon <>
List: tech-net
Date: 07/05/2007 22:14:07
On Thu, Jul 05, 2007 at 08:39:39PM -0400, Greg A. Woods wrote:
> I'm not even sure that sockets returned from accept() do in fact inherit
> their options from the listening socket.  A quick browse of the accept()
> code and annotations in TCP/IP Illustrated Vol2 suggests not, but I may
> be mistaken.

They do, and always were intended to -- but we had a bug for many years
that caused the watermarks and timeouts to not be copied.  I just fixed
it a few days ago.

Notoriously, Linux does not propagate this state from the listen socket
to the accepted sockets, though the Berkeley documentation has always
been pretty clear that that is part of the API.  I don't think they even
propagate whether the socket's blocking or not -- which is why you see
modern application code doing eight setsockopts and a fcntl every time
it accepts a connection, ugh.