qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Separate alias_addr (10.0.2.2) from our_addr in


From: Ben Taylor
Subject: Re: [Qemu-devel] [PATCH] Separate alias_addr (10.0.2.2) from our_addr in slirp
Date: Mon, 1 May 2006 20:58:22 -0400

---- Ed Swierk <address@hidden> wrote: 
> On 5/1/06, Fabrice Bellard <address@hidden> wrote:
> I am not sure this patch is sufficient: sometimes our_addr is used to
> open socket on the host side and 10.0.2.2 has a meanning only on the VM
> side.

Indeed, our_addr seems to be used for two distinct purposes:

- application protocol emulation code (like udp_emu() in udp.c) uses
the "host" address for opening sockets on the host; I'm not familiar
with the details of these protocols, but in any event it must be some
address that is meaningful to applications running on the host side;

- elsewhere in slirp, the "alias" address (10.0.2.2) is used to
rewrite the source address of packets originating from the host to the
VM; this address makes sense only within the VM.

The attached patch adds a new global, alias_addr, that is set to
10.0.2.2 and replaces our_addr in the latter cases. The patch also
changes getouraddr() so that it always returns either a "real" address
(as determined by gethostbyname(gethostname()) or 127.0.0.1, but never
10.0.2.2.

--Ed

Am I seeing a problem in line 98 of slirp/misc.c? The line above reads:

if (our_addr.s_addr == 0)
  our_addr.s_addr == loopback_addr.s_addr: 

Shouldn't that be "our_addr.s_addr = loopback_addr.s_addr;"   (Single =)

Ben




reply via email to

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