diff mbox

slirp: fix ipv6 guest network access with windows host

Message ID CA+VNGG0RAT7ZbH42kw=DxptSPODmE_tfgvfQmSYNg6f-u=t-fw@mail.gmail.com
State New
Headers show

Commit Message

Bo Hu Nov. 2, 2016, 11:02 p.m. UTC
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(+)

  DEBUG_ARGS((dfd, " m = %p  iphlen = %2d  inso = %p\n",
diff mbox

Patch

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");