Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Aug 2006 18:18:17 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc:        cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/netinet tcp_subr.c
Message-ID:  <20060802181553.V56791@fledge.watson.org>
In-Reply-To: <20060802170712.GB970@troutmask.apl.washington.edu>
References:  <200608021618.k72GI5Bc069006@repoman.freebsd.org> <20060802170712.GB970@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060802181553.V56791>