From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
To: steven@steven676.net
Cc: Jan Kiszka <jan.kiszka@siemens.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] slirp: Propagate host TCP RST to the guest.
Date: Wed, 6 Apr 2016 10:36:01 +0200 [thread overview]
Message-ID: <20160406083601.GK14668@toto> (raw)
In-Reply-To: <1c0611a61621b2069df831b48b937fa49cc264bd.1459896208.git.steven@steven676.net>
On Tue, Apr 05, 2016 at 05:14:31PM -0700, steven@steven676.net wrote:
> When the host aborts (RST) it's side of a TCP connection we need to
> propagate that RST to the guest. The current code can leave such guest
> connections dangling forever. Spotted by Jason Wessel.
>
> [steven@steven676.net: coding style adjustments]
> Signed-off-by: Steven Luo <steven+qemu@steven676.net>
> ---
> Edgar proposed this patch many years ago:
>
> https://lists.gnu.org/archive/html/qemu-devel/2008-06/msg00383.html
>
> It doesn't appear that it was ever merged. (It's the top Google result
> for "QEMU slirp RST".) I've been unable to test the specific case it
> addresses (an established connection interrupted by RST), but the
> discussion from 2008 seems to imply it worked for the person reporting
> the problem then, and my next patch builds on this one.
>
> As this patch isn't my work and did not come with a Signed-off-by line,
> I'm not entirely clear on how I should handle that.
Hi Steven,
I don't mind to leave it as is but you could also use the --author
argument to git commit to keep the authorship as edgar.iglesias@gmail.com
BTW, I had totally forgotten about this... thanks for picking it up!
Best regards,
Edgar
>
> slirp/socket.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/slirp/socket.c b/slirp/socket.c
> index b836c42..4372ec2 100644
> --- a/slirp/socket.c
> +++ b/slirp/socket.c
> @@ -176,9 +176,24 @@ soread(struct socket *so)
> if (nn < 0 && (errno == EINTR || errno == EAGAIN))
> return 0;
> else {
> + int err;
> + socklen_t slen = sizeof err;
> +
> + err = errno;
> + if (nn == 0) {
> + getsockopt(so->s, SOL_SOCKET, SO_ERROR,
> + &err, &slen);
> + }
> +
> DEBUG_MISC((dfd, " --- soread() disconnected, nn = %d, errno = %d-%s\n", nn, errno,strerror(errno)));
> sofcantrcvmore(so);
> - tcp_sockclosed(sototcpcb(so));
> +
> + if (err == ECONNRESET
> + || err == ENOTCONN || err == EPIPE) {
> + tcp_drop(sototcpcb(so), err);
> + } else {
> + tcp_sockclosed(sototcpcb(so));
> + }
> return -1;
> }
> }
> --
> 2.1.4
>
next prev parent reply other threads:[~2016-04-06 9:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 0:13 [Qemu-devel] [PATCH 0/3] slirp: deliver received TCP RSTs to the guest steven
2016-04-06 0:14 ` [Qemu-devel] [PATCH 1/3] slirp: don't crash when tcp_sockclosed() is called with a NULL tp steven
2016-04-06 0:14 ` [Qemu-devel] [PATCH 2/3] slirp: Propagate host TCP RST to the guest steven
2016-04-06 8:28 ` Paolo Bonzini
2016-04-06 8:36 ` Edgar E. Iglesias [this message]
2016-04-06 14:59 ` Steven Luo
2016-04-06 0:14 ` [Qemu-devel] [PATCH 3/3] slirp: handle deferred ECONNREFUSED on non-blocking TCP sockets steven
2016-04-06 7:26 ` [Qemu-devel] [PATCH 0/3] slirp: deliver received TCP RSTs to the guest Thomas Huth
2016-04-06 8:40 ` Edgar E. Iglesias
2016-04-06 12:57 ` Samuel Thibault
2016-04-07 0:00 ` Steven Luo
2016-04-07 0:17 ` Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160406083601.GK14668@toto \
--to=edgar.iglesias@xilinx.com \
--cc=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
--cc=steven@steven676.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).