diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2009-07-22 17:03:52 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-07-27 14:08:23 -0500 |
commit | bb53fc5394201c0cbe3c89a1c9fa5fbd6a3b832c (patch) | |
tree | 6221237599839d4f1e5477329a8421a892ae3732 /slirp | |
parent | switch -drive to QemuOpts. (diff) | |
download | qemu-kvm-bb53fc5394201c0cbe3c89a1c9fa5fbd6a3b832c.tar.gz qemu-kvm-bb53fc5394201c0cbe3c89a1c9fa5fbd6a3b832c.tar.bz2 qemu-kvm-bb53fc5394201c0cbe3c89a1c9fa5fbd6a3b832c.zip |
slirp: Fix guestfwd for incoming data
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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'slirp')
-rw-r--r-- | slirp/libslirp.h | 2 | ||||
-rw-r--r-- | slirp/slirp.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 3bcc3923f..93087ed74 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 0ce62a37a..9be855313 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)); } |