From: Samuel Thibault <samuel.thibault@gnu.org>
To: Programmingkid <programmingkidx@gmail.com>
Cc: Thomas Huth <thuth@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
Date: Thu, 28 Apr 2016 14:18:08 +0200 [thread overview]
Message-ID: <20160428121808.GE3153@var.bordeaux.inria.fr> (raw)
In-Reply-To: <51A2E196-A95B-4133-BC9E-2B820502633E@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 350 bytes --]
Programmingkid, on Wed 27 Apr 2016 20:25:26 -0400, wrote:
> Found out which patch was causing problems. This one:
>
> commit 5379229a2708df3a1506113315214c3ce5325859
> Author: Guillaume Subiron <maethor@subiron.org>
> Date: Sat Dec 19 22:24:59 2015 +0100
>
> slirp: Factorizing address translation
Could you try the attached patch?
Samuel
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2110 bytes --]
diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c
index 590dada..5ffc7a6 100644
--- a/slirp/ip_icmp.c
+++ b/slirp/ip_icmp.c
@@ -186,7 +186,7 @@ icmp_input(struct mbuf *m, int hlen)
sotranslate_out(so, &addr);
if(sendto(so->s, icmp_ping_msg, strlen(icmp_ping_msg), 0,
- (struct sockaddr *)&addr, sizeof(addr)) == -1) {
+ (struct sockaddr *)&addr, sockaddr_size(&addr)) == -1) {
DEBUG_MISC((dfd,"icmp_input udp sendto tx errno = %d-%s\n",
errno,strerror(errno)));
icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno));
diff --git a/slirp/socket.c b/slirp/socket.c
index bd97b2d..a10eff1 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -627,7 +627,7 @@ sosendto(struct socket *so, struct mbuf *m)
/* Don't care what port we get */
ret = sendto(so->s, m->m_data, m->m_len, 0,
- (struct sockaddr *)&addr, sizeof(addr));
+ (struct sockaddr *)&addr, sockaddr_size(&addr));
if (ret < 0)
return -1;
diff --git a/slirp/socket.h b/slirp/socket.h
index 7dca506..b602e69 100644
--- a/slirp/socket.h
+++ b/slirp/socket.h
@@ -122,6 +122,18 @@ static inline int sockaddr_equal(struct sockaddr_storage *a,
return 0;
}
+static inline socklen_t sockaddr_size(struct sockaddr_storage *a)
+{
+ switch (a->ss_family) {
+ case AF_INET:
+ return sizeof(struct sockaddr_in);
+ case AF_INET6:
+ return sizeof(struct sockaddr_in6);
+ default:
+ g_assert_not_reached();
+ }
+}
+
struct socket *solookup(struct socket **, struct socket *,
struct sockaddr_storage *, struct sockaddr_storage *);
struct socket *socreate(Slirp *);
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 32ff452..58eaf59 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -413,7 +413,7 @@ int tcp_fconnect(struct socket *so, unsigned short af)
sotranslate_out(so, &addr);
/* We don't care what port we get */
- ret = connect(s,(struct sockaddr *)&addr,sizeof (addr));
+ ret = connect(s,(struct sockaddr *)&addr, sockaddr_size(&addr));
/*
* If it's not in progress, it failed, so we just return 0,
next prev parent reply other threads:[~2016-04-28 12:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 16:14 [Qemu-devel] Is anyone able to load a web page from a guest operating system? Programmingkid
2016-04-26 19:00 ` Dr. David Alan Gilbert
2016-04-26 19:25 ` Programmingkid
2016-04-26 20:12 ` Thomas Huth
2016-04-26 20:19 ` Programmingkid
2016-04-27 6:34 ` Thomas Huth
2016-04-28 0:25 ` Programmingkid
2016-04-28 12:04 ` Samuel Thibault
2016-04-28 12:18 ` Samuel Thibault [this message]
2016-04-28 16:45 ` Programmingkid
2016-04-27 10:05 ` Laszlo Ersek
2016-04-27 10:26 ` Thomas Huth
2016-04-27 11:01 ` Laszlo Ersek
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=20160428121808.GE3153@var.bordeaux.inria.fr \
--to=samuel.thibault@gnu.org \
--cc=dgilbert@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=programmingkidx@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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).