From: Jason Wessel <jason.wessel@windriver.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] Fix slirp mac address init
Date: Wed, 9 Apr 2008 23:22:23 -0500 [thread overview]
Message-ID: <1207801343-15955-3-git-send-email-jason.wessel@windriver.com> (raw)
In-Reply-To: <1207801343-15955-2-git-send-email-jason.wessel@windriver.com>
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
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
next prev parent reply other threads:[~2008-04-10 4:22 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 ` Jason Wessel [this message]
2008-04-12 12:44 ` [Qemu-devel] [PATCH 2/2] Fix slirp mac address init Aurelien Jarno
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=1207801343-15955-3-git-send-email-jason.wessel@windriver.com \
--to=jason.wessel@windriver.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).