All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] Fix slirp mac address init
Date: Sat, 12 Apr 2008 14:44:48 +0200	[thread overview]
Message-ID: <20080412124448.GA29404@volta.aurel32.net> (raw)
In-Reply-To: <1207801343-15955-3-git-send-email-jason.wessel@windriver.com>

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 <jason.wessel@windriver.com>
> ---
>  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

  reply	other threads:[~2008-04-12 12:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10  4:22 [Qemu-devel] [PATCH 0/2] slirp udp fixes Jason Wessel
2008-04-10  4:22 ` [Qemu-devel] [PATCH 1/2] Fix slirp udp source address contamination Jason Wessel
2008-04-10  4:22   ` [Qemu-devel] [PATCH 2/2] Fix slirp mac address init Jason Wessel
2008-04-12 12:44     ` Aurelien Jarno [this message]
2008-04-12 14:21       ` Jason Wessel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080412124448.GA29404@volta.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.