From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jkf6H-0000Ys-Hc for qemu-devel@nongnu.org; Sat, 12 Apr 2008 08:44:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jkf6G-0000Yg-0D for qemu-devel@nongnu.org; Sat, 12 Apr 2008 08:44:56 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jkf6F-0000Yc-Ra for qemu-devel@nongnu.org; Sat, 12 Apr 2008 08:44:55 -0400 Received: from hall.aurel32.net ([88.191.38.19]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jkf6F-0000UB-AT for qemu-devel@nongnu.org; Sat, 12 Apr 2008 08:44:55 -0400 Received: from volta.aurel32.net ([2002:52e8:2fb:1:21e:8cff:feb0:693b]) by hall.aurel32.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1Jkf68-0003Gu-Dr for qemu-devel@nongnu.org; Sat, 12 Apr 2008 14:44:48 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1Jkf68-0007iD-GX for qemu-devel@nongnu.org; Sat, 12 Apr 2008 14:44:48 +0200 Date: Sat, 12 Apr 2008 14:44:48 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH 2/2] Fix slirp mac address init Message-ID: <20080412124448.GA29404@volta.aurel32.net> References: <1207801343-15955-1-git-send-email-jason.wessel@windriver.com> <1207801343-15955-2-git-send-email-jason.wessel@windriver.com> <1207801343-15955-3-git-send-email-jason.wessel@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1207801343-15955-3-git-send-email-jason.wessel@windriver.com> Reply-To: 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 On Wed, Apr 09, 2008 at 11:22:23PM -0500, Jason Wessel wrote: > It is not possible to communicate to a qemu instance via a slirp > redirected udp port until the OS running in qemu has executed a dhcp > request. This is because the internal qemu dhcp server populates the Could you please more details? I am unable to reproduce the problem. A simple netcat listening on a UDP port in the guest, and another netcat in the host to send data works here. > slirp mac address. Until the dhcp request is processed the translated > mac address is zeroed out and the packets bound for the target OS will > not correctly get the mac address of the qemu ethernet adapter. > > The solution is to initialize the slirp mac address when the qemu > network adapter client is initialized. This allows the use > bi-directional udp redirection with a static IP address configured on > the qemu ethernet adapter. > > Signed-off-by: Jason Wessel > --- > slirp/libslirp.h | 2 ++ > slirp/slirp.c | 5 +++++ > vl.c | 3 +++ > 3 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/slirp/libslirp.h b/slirp/libslirp.h > index 7e4cfa9..e862de6 100644 > --- a/slirp/libslirp.h > +++ b/slirp/libslirp.h > @@ -7,6 +7,8 @@ extern "C" { > > void slirp_init(void); > > +void slirp_initial_mac(uint8_t *macaddr); > + > void slirp_select_fill(int *pnfds, > fd_set *readfds, fd_set *writefds, fd_set *xfds); > > diff --git a/slirp/slirp.c b/slirp/slirp.c > index 303f482..8adc027 100644 > --- a/slirp/slirp.c > +++ b/slirp/slirp.c > @@ -136,6 +136,11 @@ static void slirp_cleanup(void) > } > #endif > > +void slirp_initial_mac(uint8_t *macaddr) > +{ > + memcpy(client_ethaddr, macaddr, sizeof(client_ethaddr)); > +} > + > void slirp_init(void) > { > // debug_init("/tmp/slirp.log", DEBUG_DEFAULT); > diff --git a/vl.c b/vl.c > index 6aa27c2..2fd1868 100644 > --- a/vl.c > +++ b/vl.c > @@ -4792,6 +4792,9 @@ static int net_client_init(const char *str) > return -1; > } > } > +#ifdef CONFIG_SLIRP > + slirp_initial_mac(macaddr); > +#endif > if (get_param_value(buf, sizeof(buf), "model", p)) { > nd->model = strdup(buf); > } > -- > 1.5.4 > > > > -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net