cvs commit: src/sys/netinet tcp_subr.c

Robert Watson rwatson at FreeBSD.org
Wed Aug 2 17:18:18 UTC 2006


On Wed, 2 Aug 2006, Steve Kargl wrote:

> On Wed, Aug 02, 2006 at 04:18:05PM +0000, Robert Watson wrote:
>>
>>   Modified files:
>>     sys/netinet          tcp_subr.c
>>   Log:
>>   Move soisdisconnected() in tcp_discardcb() to one of its calling contexts,
>>   tcp_twstart(), but not to the other, tcp_detach(), as the socket is
>>   already being torn down and therefore there are no listeners.  This avoids
>>   a panic if kqueue state is registered on the socket at close(), and
>>   eliminates to XXX comments.  There is one case remaining in which
>>   tcp_discardcb() reaches up to the socket layer as part of the TCP host
>>   cache, which would be good to avoid.
>
> Thanks!  You beat me to my bug report.

I find myself a bit unsure about the entirely right solution here, though -- 
protocols inconsistently use soisdisconnected(), and at sometimes odd times. 
It's clear that, by the time the socket is being freed, the call to 
soisdisconnected() is too late to be useful.  Some protocols, especially 
datagram protocols, don't use soisdisconnected(), they just remove the 
connected flag from the socket.  It's not clear to me whether protocols should 
always invoke soisdisconnected() on every socket that's been at least 
partially connected, and when they should do that.  By pru_detach it's too 
late, but perhaps at pru_close and pru_abort?  Or perhaps the socket layer 
should auto-notify at that point, or just prior to pru_detach...

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the cvs-src mailing list