* [Qemu-devel] [PATCH] slirp: Fix guestfwd for incoming data
@ 2009-07-22 15:03 Jan Kiszka
2009-07-22 17:28 ` [Qemu-devel] " Richard W.M. Jones
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2009-07-22 15:03 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel, Richard W.M. Jones
Unless a virtual server address was explicitly defined (which is
impossible with the legacy -net channel format), guestfwd did not
properly forwarded host->guest packets. This patch fixes it.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
net.c | 11 ++++++-----
slirp/libslirp.h | 2 +-
slirp/slirp.c | 14 +++++++-------
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/net.c b/net.c
index 90cf912..1c2c7d0 100644
--- a/net.c
+++ b/net.c
@@ -1150,7 +1150,7 @@ static void slirp_smb(SlirpState* s, Monitor *mon, const char *exported_dir,
snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
SMBD_COMMAND, smb_conf);
- if (slirp_add_exec(s->slirp, 0, smb_cmdline, vserver_addr, 139) < 0) {
+ if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0) {
slirp_smb_cleanup(s);
config_error(mon, "conflicting/invalid smbserver address\n");
}
@@ -1239,16 +1239,17 @@ static void slirp_guestfwd(SlirpState *s, Monitor *mon, const char *config_str,
qemu_free(fwd);
return;
}
- fwd->server = server;
- fwd->port = port;
- fwd->slirp = s->slirp;
- if (slirp_add_exec(s->slirp, 3, fwd->hd, server, port) < 0) {
+ if (slirp_add_exec(s->slirp, 3, fwd->hd, &server, port) < 0) {
config_error(mon, "conflicting/invalid host:port in guest forwarding "
"rule '%s'\n", config_str);
qemu_free(fwd);
return;
}
+ fwd->server = server;
+ fwd->port = port;
+ fwd->slirp = s->slirp;
+
qemu_chr_add_handlers(fwd->hd, guestfwd_can_read, guestfwd_read,
NULL, fwd);
return;
diff --git a/slirp/libslirp.h b/slirp/libslirp.h
index 3bcc392..93087ed 100644
--- a/slirp/libslirp.h
+++ b/slirp/libslirp.h
@@ -33,7 +33,7 @@ int slirp_add_hostfwd(Slirp *slirp, int is_udp,
int slirp_remove_hostfwd(Slirp *slirp, int is_udp,
struct in_addr host_addr, int host_port);
int slirp_add_exec(Slirp *slirp, int do_pty, const void *args,
- struct in_addr guest_addr, int guest_port);
+ struct in_addr *guest_addr, int guest_port);
void slirp_connection_info(Slirp *slirp, Monitor *mon);
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 0ce62a3..9be8553 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -794,19 +794,19 @@ int slirp_add_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr,
}
int slirp_add_exec(Slirp *slirp, int do_pty, const void *args,
- struct in_addr guest_addr, int guest_port)
+ struct in_addr *guest_addr, int guest_port)
{
- if (!guest_addr.s_addr) {
- guest_addr.s_addr = slirp->vnetwork_addr.s_addr |
+ if (!guest_addr->s_addr) {
+ guest_addr->s_addr = slirp->vnetwork_addr.s_addr |
(htonl(0x0204) & ~slirp->vnetwork_mask.s_addr);
}
- if ((guest_addr.s_addr & slirp->vnetwork_mask.s_addr) !=
+ if ((guest_addr->s_addr & slirp->vnetwork_mask.s_addr) !=
slirp->vnetwork_addr.s_addr ||
- guest_addr.s_addr == slirp->vhost_addr.s_addr ||
- guest_addr.s_addr == slirp->vnameserver_addr.s_addr) {
+ guest_addr->s_addr == slirp->vhost_addr.s_addr ||
+ guest_addr->s_addr == slirp->vnameserver_addr.s_addr) {
return -1;
}
- return add_exec(&slirp->exec_list, do_pty, (char *)args, guest_addr,
+ return add_exec(&slirp->exec_list, do_pty, (char *)args, *guest_addr,
htons(guest_port));
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH] slirp: Fix guestfwd for incoming data
2009-07-22 15:03 [Qemu-devel] [PATCH] slirp: Fix guestfwd for incoming data Jan Kiszka
@ 2009-07-22 17:28 ` Richard W.M. Jones
2009-07-22 18:56 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Richard W.M. Jones @ 2009-07-22 17:28 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Anthony Liguori, qemu-devel
On Wed, Jul 22, 2009 at 05:03:52PM +0200, Jan Kiszka wrote:
> Unless a virtual server address was explicitly defined (which is
> impossible with the legacy -net channel format), guestfwd did not
> properly forwarded host->guest packets. This patch fixes it.
Yes, I've confirmed this works.
PLEASE apply this patch!
Thanks, Rich.
--
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH] slirp: Fix guestfwd for incoming data
2009-07-22 17:28 ` [Qemu-devel] " Richard W.M. Jones
@ 2009-07-22 18:56 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2009-07-22 18:56 UTC (permalink / raw)
To: Richard W.M. Jones; +Cc: Anthony Liguori, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
Richard W.M. Jones wrote:
> On Wed, Jul 22, 2009 at 05:03:52PM +0200, Jan Kiszka wrote:
>> Unless a virtual server address was explicitly defined (which is
>> impossible with the legacy -net channel format), guestfwd did not
>> properly forwarded host->guest packets. This patch fixes it.
>
> Yes, I've confirmed this works.
>
> PLEASE apply this patch!
>
> Thanks, Rich.
>
Great.
Just leaves us with that syntax wreckage. Will try to look into -char
support like Anthony suggested.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-22 18:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22 15:03 [Qemu-devel] [PATCH] slirp: Fix guestfwd for incoming data Jan Kiszka
2009-07-22 17:28 ` [Qemu-devel] " Richard W.M. Jones
2009-07-22 18:56 ` Jan Kiszka
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).