qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] slirp: fix ipv6 guest network access with windows host
@ 2016-11-02 23:02 Bo Hu
  2016-11-02 23:12 ` Samuel Thibault
  0 siblings, 1 reply; 2+ messages in thread
From: Bo Hu @ 2016-11-02 23:02 UTC (permalink / raw)
  To: samuel.thibault, jan.kiszka; +Cc: qemu-devel, sw

Hello qemu developers,

    This patch is from android emulator (which is based on qemu2.2) and I
hope this patch is
also useful to upstream qemu as well.

bo




>From 021eac8c593a34a6a5e106d187a8e1fd22a1522f Mon Sep 17 00:00:00 2001
From: bohu <bohu@google.com>
Date: Wed, 2 Nov 2016 15:56:26 -0700
Subject: [PATCH] slirp: fix ipv6 guest network access with windows host

In tcp_input function, local sockaddr_storage variables lhost
and fhost are used without being cleared to zero; and consequently
tcp connect call fails on windows because there is some random data
in those variables (windows complains with WSAEADDRNOTAVAIL);

This CL calls memset to clear those two variables so that the address
passed to connect does not have random data in it.

Signed-off-by: Bo Hu <bohu@google.com>
---
 slirp/tcp_input.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index c5063a9..9a79a16 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -234,6 +234,8 @@ tcp_input(struct mbuf *m, int iphlen, struct socket
*inso, unsigned short af)
  struct sockaddr_in6 *lhost6, *fhost6;
     struct ex_list *ex_ptr;
     Slirp *slirp;
+    memset(&lhost, 0, sizeof(lhost);
+    memset(&fhost, 0, sizeof(fhost);

  DEBUG_CALL("tcp_input");
  DEBUG_ARGS((dfd, " m = %p  iphlen = %2d  inso = %p\n",
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] slirp: fix ipv6 guest network access with windows host
  2016-11-02 23:02 [Qemu-devel] slirp: fix ipv6 guest network access with windows host Bo Hu
@ 2016-11-02 23:12 ` Samuel Thibault
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Thibault @ 2016-11-02 23:12 UTC (permalink / raw)
  To: Bo Hu; +Cc: jan.kiszka, qemu-devel, sw

Hello,

Bo Hu, on Wed 02 Nov 2016 16:02:29 -0700, wrote:
>     This patch is from android emulator (which is based on qemu2.2) and I hope
> this patch is
> also useful to upstream qemu as well.

Indeed, even if normally we fill all required fields, it's probably
better to memset the whole structure.

> From 021eac8c593a34a6a5e106d187a8e1fd22a1522f Mon Sep 17 00:00:00 2001
> From: bohu <[1]bohu@google.com>
> Date: Wed, 2 Nov 2016 15:56:26 -0700
> Subject: [PATCH] slirp: fix ipv6 guest network access with windows host
> 
> In tcp_input function, local sockaddr_storage variables lhost
> and fhost are used without being cleared to zero; and consequently
> tcp connect call fails on windows because there is some random data
> in those variables (windows complains with WSAEADDRNOTAVAIL);
> 
> This CL calls memset to clear those two variables so that the address
> passed to connect does not have random data in it.
> 
> Signed-off-by: Bo Hu <[2]bohu@google.com>

> +    memset(&lhost, 0, sizeof(lhost);
> +    memset(&fhost, 0, sizeof(fhost);

There is just a typo: missing closing parenthesis...

But apart from that,
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Samuel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-02 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-02 23:02 [Qemu-devel] slirp: fix ipv6 guest network access with windows host Bo Hu
2016-11-02 23:12 ` Samuel Thibault

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).