qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/2] Fix slirp mac address init


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [PATCH 2/2] Fix slirp mac address init
Date: Sat, 12 Apr 2008 14:44:48 +0200
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

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 <address@hidden>
> ---
>  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
 `. `'   address@hidden         | address@hidden
   `-    people.debian.org/~aurel32 | www.aurel32.net




reply via email to

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