All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Is anyone able to load a web page from a guest operating system?
@ 2016-04-26 16:14 Programmingkid
  2016-04-26 19:00 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 13+ messages in thread
From: Programmingkid @ 2016-04-26 16:14 UTC (permalink / raw)
  To: qemu-devel qemu-devel

My three guest operating systems can't load a web page. I think this is a bug with QEMU. Is there anyone who has the latest revision of QEMU that can access the web from a guest? Or are you experiencing the same problem?

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Dr. David Alan Gilbert @ 2016-04-26 19:00 UTC (permalink / raw)
  To: Programmingkid; +Cc: qemu-devel qemu-devel

* Programmingkid (programmingkidx@gmail.com) wrote:
> My three guest operating systems can't load a web page. I think this is a bug with QEMU. Is there anyone who has the latest revision of QEMU that can access the web from a guest? Or are you experiencing the same problem?

Works here.

Now - how about some basic debug!
Does your guest see a network card?
Does DNS work?
Does ping work?
Does a telnet/ssh from the guest work?
What's the qemu command line you use?

Dave

--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-26 19:00 ` Dr. David Alan Gilbert
@ 2016-04-26 19:25   ` Programmingkid
  2016-04-26 20:12     ` Thomas Huth
  0 siblings, 1 reply; 13+ messages in thread
From: Programmingkid @ 2016-04-26 19:25 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel qemu-devel


On Apr 26, 2016, at 3:00 PM, Dr. David Alan Gilbert wrote:

> * Programmingkid (programmingkidx@gmail.com) wrote:
>> My three guest operating systems can't load a web page. I think this is a bug with QEMU. Is there anyone who has the latest revision of QEMU that can access the web from a guest? Or are you experiencing the same problem?
> 
> Works here.
So you are using a very recent version of QEMU? Maybe something that was pulled in the last day or so?

> Now - how about some basic debug!
> Does your guest see a network card?
yes

> Does DNS work?
Doesn't look like it. If I use just an ip address it still doesn't work.

> Does ping work?
I can ping the virtual router at 10.0.2.2. Any other ip address fails. 

> Does a telnet/ssh from the guest work?
telnet www.google.com 80     failed
Didn't have an address to use ssh on.

> What's the qemu command line you use?
qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device usb-net,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 

and

qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device rtl8139,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 

This and my other guest did access the internet before. 

Thanks for helping.

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-26 19:25   ` Programmingkid
@ 2016-04-26 20:12     ` Thomas Huth
  2016-04-26 20:19       ` Programmingkid
  2016-04-27 10:05       ` Laszlo Ersek
  0 siblings, 2 replies; 13+ messages in thread
From: Thomas Huth @ 2016-04-26 20:12 UTC (permalink / raw)
  To: Programmingkid, Dr. David Alan Gilbert
  Cc: qemu-devel qemu-devel, Samuel Thibault

On 26.04.2016 21:25, Programmingkid wrote:
> 
> On Apr 26, 2016, at 3:00 PM, Dr. David Alan Gilbert wrote:
> 
>> * Programmingkid (programmingkidx@gmail.com) wrote:
>>> My three guest operating systems can't load a web page. I think this is a bug with QEMU. Is there anyone who has the latest revision of QEMU that can access the web from a guest? Or are you experiencing the same problem?
>>
>> Works here.
> So you are using a very recent version of QEMU? Maybe something that was pulled in the last day or so?
> 
>> Now - how about some basic debug!
>> Does your guest see a network card?
> yes
> 
>> Does DNS work?
> Doesn't look like it. If I use just an ip address it still doesn't work.
> 
>> Does ping work?
> I can ping the virtual router at 10.0.2.2. Any other ip address fails. 

That's normal for user-mode / slirp networking. You can't ping external
hosts with this mode.

>> Does a telnet/ssh from the guest work?
> telnet www.google.com 80     failed
> Didn't have an address to use ssh on.
> 
>> What's the qemu command line you use?
> qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device usb-net,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 
> 
> and
> 
> qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device rtl8139,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 

Ok, that means you're using user-mode / slirp networking.
I just tried it with a pseries guest, and it seems to be working fine
for me with the current git version of QEMU (f419a626c76bcb266).

Now, what kind of host do you use? Mac OS X?
Also can you determine a revision when it was still working fine for
you? (and then maybe even bisect the problem?)

 Thomas

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-26 20:12     ` Thomas Huth
@ 2016-04-26 20:19       ` Programmingkid
  2016-04-27  6:34         ` Thomas Huth
  2016-04-27 10:05       ` Laszlo Ersek
  1 sibling, 1 reply; 13+ messages in thread
From: Programmingkid @ 2016-04-26 20:19 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Dr. David Alan Gilbert, qemu-devel qemu-devel, Samuel Thibault


On Apr 26, 2016, at 4:12 PM, Thomas Huth wrote:

> On 26.04.2016 21:25, Programmingkid wrote:
>> 
>> On Apr 26, 2016, at 3:00 PM, Dr. David Alan Gilbert wrote:
>> 
>>> * Programmingkid (programmingkidx@gmail.com) wrote:
>>>> My three guest operating systems can't load a web page. I think this is a bug with QEMU. Is there anyone who has the latest revision of QEMU that can access the web from a guest? Or are you experiencing the same problem?
>>> 
>>> Works here.
>> So you are using a very recent version of QEMU? Maybe something that was pulled in the last day or so?
>> 
>>> Now - how about some basic debug!
>>> Does your guest see a network card?
>> yes
>> 
>>> Does DNS work?
>> Doesn't look like it. If I use just an ip address it still doesn't work.
>> 
>>> Does ping work?
>> I can ping the virtual router at 10.0.2.2. Any other ip address fails. 
> 
> That's normal for user-mode / slirp networking. You can't ping external
> hosts with this mode.
> 
>>> Does a telnet/ssh from the guest work?
>> telnet www.google.com 80     failed
>> Didn't have an address to use ssh on.
>> 
>>> What's the qemu command line you use?
>> qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device usb-net,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 
>> 
>> and
>> 
>> qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device rtl8139,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 
> 
> Ok, that means you're using user-mode / slirp networking.
> I just tried it with a pseries guest, and it seems to be working fine
> for me with the current git version of QEMU (f419a626c76bcb266).

So you are saying you can view web pages on your guest?

> 
> Now, what kind of host do you use? Mac OS X? 
Yes. Mac OS 10.6.

> Also can you determine a revision when it was still working fine for
> you? (and then maybe even bisect the problem?)

I will see what I can find out.

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-26 20:19       ` Programmingkid
@ 2016-04-27  6:34         ` Thomas Huth
  2016-04-28  0:25           ` Programmingkid
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Huth @ 2016-04-27  6:34 UTC (permalink / raw)
  To: Programmingkid
  Cc: Samuel Thibault, Dr. David Alan Gilbert, qemu-devel qemu-devel

On 26.04.2016 22:19, Programmingkid wrote:
> 
> On Apr 26, 2016, at 4:12 PM, Thomas Huth wrote:
> 
>> On 26.04.2016 21:25, Programmingkid wrote:
>>>
>>> On Apr 26, 2016, at 3:00 PM, Dr. David Alan Gilbert wrote:
>>>
>>>> * Programmingkid (programmingkidx@gmail.com) wrote:
>>>>> My three guest operating systems can't load a web page. I think this is a bug with QEMU. Is there anyone who has the latest revision of QEMU that can access the web from a guest? Or are you experiencing the same problem?
...
>>>> What's the qemu command line you use?
>>> qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device usb-net,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 
>>>
>>> and
>>>
>>> qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device rtl8139,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 
>>
>> Ok, that means you're using user-mode / slirp networking.
>> I just tried it with a pseries guest, and it seems to be working fine
>> for me with the current git version of QEMU (f419a626c76bcb266).
> 
> So you are saying you can view web pages on your guest?

Yes. Linux guest on a Linux host, and I was able to access a web page
from the guest.

>>
>> Now, what kind of host do you use? Mac OS X? 
> Yes. Mac OS 10.6.

Ok, at least not Windows ... because there have been some problems with
Windows recently, which could be the culprit otherwise:

http://git.qemu.org/?p=qemu.git;a=commitdiff;h=3424c8a9c89a3bc0d29ad

>> Also can you determine a revision when it was still working fine for
>> you? (and then maybe even bisect the problem?)
> 
> I will see what I can find out.

Thanks! Bisecting the problem is likely the best way to deal with this...

 Thomas

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-26 20:12     ` Thomas Huth
  2016-04-26 20:19       ` Programmingkid
@ 2016-04-27 10:05       ` Laszlo Ersek
  2016-04-27 10:26         ` Thomas Huth
  1 sibling, 1 reply; 13+ messages in thread
From: Laszlo Ersek @ 2016-04-27 10:05 UTC (permalink / raw)
  To: Thomas Huth, Programmingkid, Dr. David Alan Gilbert
  Cc: Samuel Thibault, qemu-devel qemu-devel

On 04/26/16 22:12, Thomas Huth wrote:
> On 26.04.2016 21:25, Programmingkid wrote:
>> On Apr 26, 2016, at 3:00 PM, Dr. David Alan Gilbert wrote:

>>> Does ping work?
>> I can ping the virtual router at 10.0.2.2. Any other ip address fails. 
> 
> That's normal for user-mode / slirp networking. You can't ping external
> hosts with this mode.

Side note: yes, you can.

I do it whenever I want to check network connectivity from within ad-hoc
OVMF guests, using the PING command of the UEFI shell. ("Ad-hoc guest"
implies user-mode / slirp.)

It can be enabled with the following steps:

(1) Determine the main group ID (or one supplementary group ID) of the
user that will run QEMU with slirp.

(2) In /etc/sysctl.conf (or whatever is appropriate for your host
distro), make sure that the whitespace separated inclusive group ID
range in the "net.ipv4.ping_group_range" sysctl includes the above group ID.

For example,

- you could add a new group called "unpriv_ping":

  groupadd unpriv_ping

- set this group for a number of users as another supplementary group:

  for U in user1 user2 ... usern; do
    usermod --append --groups unpriv_ping $U
  done

  (note, they will have to re-login),

- then set both sides of the inclusive range in the above sysctl to the
  numeric ID of the new group:

  (
    GROUP_ID=$(getent group unpriv_ping | cut -f 3 -d :)
    printf 'net.ipv4.ping_group_range = %u %u\n' $GROUP_ID $GROUP_ID \
      >> /etc/sysctl.conf
  )
  sysctl -p

Thanks
Laszlo

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-27 10:05       ` Laszlo Ersek
@ 2016-04-27 10:26         ` Thomas Huth
  2016-04-27 11:01           ` Laszlo Ersek
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Huth @ 2016-04-27 10:26 UTC (permalink / raw)
  To: Laszlo Ersek, Programmingkid, Dr. David Alan Gilbert
  Cc: Samuel Thibault, qemu-devel qemu-devel

On 27.04.2016 12:05, Laszlo Ersek wrote:
> On 04/26/16 22:12, Thomas Huth wrote:
>> On 26.04.2016 21:25, Programmingkid wrote:
>>> On Apr 26, 2016, at 3:00 PM, Dr. David Alan Gilbert wrote:
> 
>>>> Does ping work?
>>> I can ping the virtual router at 10.0.2.2. Any other ip address fails. 
>>
>> That's normal for user-mode / slirp networking. You can't ping external
>> hosts with this mode.
> 
> Side note: yes, you can.
> 
> I do it whenever I want to check network connectivity from within ad-hoc
> OVMF guests, using the PING command of the UEFI shell. ("Ad-hoc guest"
> implies user-mode / slirp.)
> 
> It can be enabled with the following steps:
> 
> (1) Determine the main group ID (or one supplementary group ID) of the
> user that will run QEMU with slirp.
> 
> (2) In /etc/sysctl.conf (or whatever is appropriate for your host
> distro), make sure that the whitespace separated inclusive group ID
> range in the "net.ipv4.ping_group_range" sysctl includes the above group ID.

Wow, thanks for that hint, I just tried by temporarily enabling it with

 sudo sysctl net.ipv4.ping_group_range=...

and indeed it works!

Maybe we should document that somewhere?
For example  http://qemu-project.org/Documentation/Networking currently
only says: "ICMP traffic does not work (so you cannot use ping within a
guest)" ...

 Thomas

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-27 10:26         ` Thomas Huth
@ 2016-04-27 11:01           ` Laszlo Ersek
  0 siblings, 0 replies; 13+ messages in thread
From: Laszlo Ersek @ 2016-04-27 11:01 UTC (permalink / raw)
  To: Thomas Huth, Programmingkid, Dr. David Alan Gilbert
  Cc: Samuel Thibault, qemu-devel qemu-devel

On 04/27/16 12:26, Thomas Huth wrote:
> On 27.04.2016 12:05, Laszlo Ersek wrote:
>> On 04/26/16 22:12, Thomas Huth wrote:
>>> On 26.04.2016 21:25, Programmingkid wrote:
>>>> On Apr 26, 2016, at 3:00 PM, Dr. David Alan Gilbert wrote:
>>
>>>>> Does ping work?
>>>> I can ping the virtual router at 10.0.2.2. Any other ip address fails. 
>>>
>>> That's normal for user-mode / slirp networking. You can't ping external
>>> hosts with this mode.
>>
>> Side note: yes, you can.
>>
>> I do it whenever I want to check network connectivity from within ad-hoc
>> OVMF guests, using the PING command of the UEFI shell. ("Ad-hoc guest"
>> implies user-mode / slirp.)
>>
>> It can be enabled with the following steps:
>>
>> (1) Determine the main group ID (or one supplementary group ID) of the
>> user that will run QEMU with slirp.
>>
>> (2) In /etc/sysctl.conf (or whatever is appropriate for your host
>> distro), make sure that the whitespace separated inclusive group ID
>> range in the "net.ipv4.ping_group_range" sysctl includes the above group ID.
> 
> Wow, thanks for that hint, I just tried by temporarily enabling it with
> 
>  sudo sysctl net.ipv4.ping_group_range=...
> 
> and indeed it works!
> 
> Maybe we should document that somewhere?
> For example  http://qemu-project.org/Documentation/Networking currently
> only says: "ICMP traffic does not work (so you cannot use ping within a
> guest)" ...

Done.

Laszlo

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  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
  0 siblings, 2 replies; 13+ messages in thread
From: Programmingkid @ 2016-04-28  0:25 UTC (permalink / raw)
  To: Thomas Huth, Peter Maydell
  Cc: Samuel Thibault, Dr. David Alan Gilbert, qemu-devel qemu-devel


On Apr 27, 2016, at 2:34 AM, Thomas Huth wrote:

> On 26.04.2016 22:19, Programmingkid wrote:
>> 
>> On Apr 26, 2016, at 4:12 PM, Thomas Huth wrote:
>> 
>>> On 26.04.2016 21:25, Programmingkid wrote:
>>>> 
>>>> On Apr 26, 2016, at 3:00 PM, Dr. David Alan Gilbert wrote:
>>>> 
>>>>> * Programmingkid (programmingkidx@gmail.com) wrote:
>>>>>> My three guest operating systems can't load a web page. I think this is a bug with QEMU. Is there anyone who has the latest revision of QEMU that can access the web from a guest? Or are you experiencing the same problem?
> ...
>>>>> What's the qemu command line you use?
>>>> qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device usb-net,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 
>>>> 
>>>> and
>>>> 
>>>> qemu-system-ppc -hda <hd1> -hdb <hd2> -m 512 -boot c -M mac99 -netdev user,id=mynet0 -device rtl8139,netdev=mynet0 -cpu 750 -prom-env boot-args=-v -device ich9-usb-uhci1,id=newusb -device usb-audio,bus=newusb.0 
>>> 
>>> Ok, that means you're using user-mode / slirp networking.
>>> I just tried it with a pseries guest, and it seems to be working fine
>>> for me with the current git version of QEMU (f419a626c76bcb266).
>> 
>> So you are saying you can view web pages on your guest?
> 
> Yes. Linux guest on a Linux host, and I was able to access a web page
> from the guest.
> 
>>> 
>>> Now, what kind of host do you use? Mac OS X? 
>> Yes. Mac OS 10.6.
> 
> Ok, at least not Windows ... because there have been some problems with
> Windows recently, which could be the culprit otherwise:
> 
> http://git.qemu.org/?p=qemu.git;a=commitdiff;h=3424c8a9c89a3bc0d29ad
> 
>>> Also can you determine a revision when it was still working fine for
>>> you? (and then maybe even bisect the problem?)
>> 
>> I will see what I can find out.
> 
> Thanks! Bisecting the problem is likely the best way to deal with this...

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
    
    This patch factorizes some duplicate code into a new function,
    sotranslate_out(). This function perform the address translation when a
    packet is transmitted to the host network. If the packet is destinated
    to the host, the loopback address is used, and if the packet is
    destinated to the virtual DNS, the real DNS address is used. This code
    is just a copy of the existent, but factorized and ready to manage the
    IPv6 case.

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-28  0:25           ` Programmingkid
@ 2016-04-28 12:04             ` Samuel Thibault
  2016-04-28 12:18             ` Samuel Thibault
  1 sibling, 0 replies; 13+ messages in thread
From: Samuel Thibault @ 2016-04-28 12:04 UTC (permalink / raw)
  To: Programmingkid
  Cc: Thomas Huth, Peter Maydell, Dr. David Alan Gilbert,
	qemu-devel qemu-devel

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

Thanks!

I managed to get access to a darwin system. It seems that their sendto()
doesn't like being passed an addrlen which is greater than required: the
patch makes qemu pass sizeof(struct sockaddr_storage) instead of
sizeof(struct sockaddr_in). That's quite unexpected, but we'll have to
work around that, working on a patch now.

Samuel

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-28  0:25           ` Programmingkid
  2016-04-28 12:04             ` Samuel Thibault
@ 2016-04-28 12:18             ` Samuel Thibault
  2016-04-28 16:45               ` Programmingkid
  1 sibling, 1 reply; 13+ messages in thread
From: Samuel Thibault @ 2016-04-28 12:18 UTC (permalink / raw)
  To: Programmingkid
  Cc: Thomas Huth, Peter Maydell, Dr. David Alan Gilbert,
	qemu-devel qemu-devel

[-- 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,

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

* Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
  2016-04-28 12:18             ` Samuel Thibault
@ 2016-04-28 16:45               ` Programmingkid
  0 siblings, 0 replies; 13+ messages in thread
From: Programmingkid @ 2016-04-28 16:45 UTC (permalink / raw)
  To: Samuel Thibault
  Cc: Thomas Huth, Peter Maydell, Dr. David Alan Gilbert,
	qemu-devel qemu-devel


On Apr 28, 2016, at 8:18 AM, Samuel Thibault wrote:

> 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
> <patch.txt>

Your patch worked. 
Reviewed-by: John Arbuckle <programmingkidx@gmail.com>

Thank you.

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

end of thread, other threads:[~2016-04-28 16:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.