Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 May 2009 12:25:14 -0400
From:      Louis Mamakos <louie@transsys.com>
To:        net@freebsd.org
Cc:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Subject:   Re: SO_LINGER + shutdown(2)
Message-ID:  <608FDC77-03A7-47E5-B992-6B0ECC1BFACE@transsys.com>
In-Reply-To: <9639.1241172701@critter.freebsd.dk>
References:  <9639.1241172701@critter.freebsd.dk>

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

On May 1, 2009, at 6:11 AM, Poul-Henning Kamp wrote:

>
> I was somewhat surprised to see that calling shutdown(SHUT_WR) on
> a TCP socket with SO_LINGER set {.l_onoff =3D 1, .l_linger =3D 0} does
> not in fact flush the send queue orderly, but immediately RST's the
> connection.
>
> I realize this is an issue for the Dept. of deep TCP arcan=E6 and not
> something to be changed lightly, so consider this more of an
> observation than bug report.
>

Setting aside for the moment what applications might rely on this
behavior, this seems unexpected and perhaps wrong to me.  The intent
of the shutdown() system call in this instance ought to be to indicate
that the local end of the connection has no additional data to
transmit to the remote TCP peer.  But it ought to continue to allow
additional data to be read from the connection.  Sending a reset
segment to the far end will hardly enable that behavior.  The remote
TCP will abandon the connection and there will be no further data
forthcoming from it (aside from what might be in flight.)

If the local TCP connection has already received a FIN segment from
the far end and is in CLOSEWAIT state, then perhaps that's a bit of
a different animal..

louie=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?608FDC77-03A7-47E5-B992-6B0ECC1BFACE>