Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FajDe-00010S-So for qemu-devel@nongnu.org; Mon, 01 May 2006 20:58:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FajDc-0000yx-Hg for qemu-devel@nongnu.org; Mon, 01 May 2006 20:58:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FajDc-0000yu-8p for qemu-devel@nongnu.org; Mon, 01 May 2006 20:58:24 -0400 Received: from [68.230.240.36] (helo=eastrmmtao03.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FajDe-0004tx-Ol for qemu-devel@nongnu.org; Mon, 01 May 2006 20:58:26 -0400 Message-ID: <24734323.1146531502885.JavaMail.root@eastrmwml06.mgt.cox.net> Date: Mon, 1 May 2006 20:58:22 -0400 From: Ben Taylor Subject: Re: [Qemu-devel] [PATCH] Separate alias_addr (10.0.2.2) from our_addr in slirp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Reply-To: sol10x86@cox.net, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ---- Ed Swierk wrote: > On 5/1/06, Fabrice Bellard 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