qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] slirp: Propagate host TCP RST to the guest.


From: Edgar E. Iglesias
Subject: Re: [Qemu-devel] [PATCH 2/3] slirp: Propagate host TCP RST to the guest.
Date: Wed, 6 Apr 2016 10:36:01 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Tue, Apr 05, 2016 at 05:14:31PM -0700, address@hidden 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.
> 
> address@hidden: coding style adjustments]
> Signed-off-by: Steven Luo <address@hidden>
> ---
> 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 address@hidden

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
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]