mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 19:33:39 +08:00
slirp: Propagate host TCP RST to the guest.
When the host aborts (RST) its 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. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> [steven@steven676.net: coding style adjustments] Signed-off-by: Steven Luo <steven+qemu@steven676.net> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
parent
bfb1ac1402
commit
27d92ebc5e
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user