From: "Edgar E. Iglesias" <edgar.iglesias@axis.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] slirp: Propagate host TCP RST to the guest.
Date: Wed, 11 Jun 2008 23:47:50 +0200 [thread overview]
Message-ID: <20080611214750.GD20729@edgar.se.axis.com> (raw)
In-Reply-To: <4850313B.8030304@windriver.com>
Hi,
Jason found a bug in teh slirp TCP RST code. Here is a patch to fix it.
Is this OK to commit?
Best regards
--
Edgar E. Iglesias
Axis Communications AB
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.
diff --git a/slirp/socket.c b/slirp/socket.c
index 75003af..bb10d69 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -165,9 +165,21 @@ soread(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;
}
}
prev parent reply other threads:[~2008-06-11 21:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-11 17:21 [Qemu-devel] [PATCH] Proposed fix broken RST response to a slirp redirect socket Jason Wessel
2008-06-11 18:07 ` Edgar E. Iglesias
2008-06-11 19:37 ` Edgar E. Iglesias
2008-06-11 20:10 ` Jason Wessel
2008-06-11 20:29 ` Edgar E. Iglesias
2008-06-11 21:14 ` Jason Wessel
2008-06-11 21:47 ` Edgar E. Iglesias [this message]
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=20080611214750.GD20729@edgar.se.axis.com \
--to=edgar.iglesias@axis.com \
--cc=qemu-devel@nongnu.org \
/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).