Subject: Re: soisdisconnected/soisconnected & EPIPE
To: Bill Studenmund <wrstuden@netbsd.org>
From: Iain Hibbert <plunky@rya-online.net>
List: tech-kern
Date: 11/25/2005 20:51:15
On Wed, 16 Nov 2005, Bill Studenmund wrote:

> On Wed, Nov 16, 2005 at 08:01:54PM +0000, Iain Hibbert wrote:
> > 	a) dont do it, use sendto() instead..
> >
> > 	b) for PRU_DISCONNECT, dont actually call soisdisconnected(), just
> > 		so->so_state &= ~SS_ISCONNECTED
> >
> > 	c) for PRU_CONNECT make sure the bits are cleared
> >
> > 	d) change soisconnected() to clear those bits.
> >
> > 	e) other

> If the manpages really indicate what you mention should work, then I think
> we want either (c) or (d). My guess is (d) is best; soisdisconnected() set
> the flags, so let soisconnected() clear them.

it does seem so, connect(2) mentions it specifically as does doc/21.ipc ..

I looked through the code and this behaviour has been present forever
(since v1.1 of uipc_socket.c) though and I think it would probably need
fully investigating before changing, who knows what depends on it.

I see this comment in udp_usrreq.c (and udp6_usrreq.c and raw_ip6.c)

	case PRU_DISCONNECT:
		/*soisdisconnected(so);*/
		so->so_state &= ~SS_ISCONNECTED;	/* XXX */

so I guess the authors of those files also found this to be a problem but
did not fix it. Or maybe it doesnt need changing. For now, I will do the
same thing (but maybe put a more expansive comment) - should I send-pr
that?

iain