Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
kvm
kvm-qemu-pre11-redir-1.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kvm-qemu-pre11-redir-1.patch of Package kvm
commit d4ebe1934a89b1ab699a9485c85c42f1ec9ae2ad Author: aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> Date: Tue Apr 21 19:56:44 2009 +0000 slirp: Enhance host-guest redirection setup (Jan Kiszka) Allow to establish a TCP/UDP connection redirection also via a monitor command 'host_net_redir'. Moreover, assume TCP as connection type if that parameter is omitted. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7204 c046a42c-6fe2-441c-8c8c-71466251a162 Index: qemu-kvm-0.10.5/monitor.c =================================================================== --- qemu-kvm-0.10.5.orig/monitor.c +++ qemu-kvm-0.10.5/monitor.c @@ -1598,6 +1598,8 @@ static const term_cmd_t term_cmds[] = { { "host_net_remove", "is", net_host_device_remove, "vlan_id name", "remove host VLAN client" }, #endif + { "host_net_redir", "s", net_slirp_redir, + "[tcp|udp]:host-port:[guest-host]:guest-port", "redirect TCP or UDP connections from host to guest (requires -net user)" }, { "balloon", "i", do_balloon, "target", "request VM to change it's memory allocation (in MB)" }, { "set_link", "ss", do_set_link, Index: qemu-kvm-0.10.5/net.c =================================================================== --- qemu-kvm-0.10.5.orig/net.c +++ qemu-kvm-0.10.5/net.c @@ -540,7 +540,7 @@ void net_slirp_redir(const char *redir_s { int is_udp; char buf[256], *r; - const char *p; + const char *p, *errmsg; struct in_addr guest_addr; int host_port, guest_port; @@ -551,41 +551,48 @@ void net_slirp_redir(const char *redir_s p = redir_str; if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) - goto fail; - if (!strcmp(buf, "tcp")) { + goto fail_syntax; + if (!strcmp(buf, "tcp") || buf[0] == '\0') { is_udp = 0; } else if (!strcmp(buf, "udp")) { is_udp = 1; } else { - goto fail; + goto fail_syntax; } if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) - goto fail; + goto fail_syntax; host_port = strtol(buf, &r, 0); if (r == buf) - goto fail; + goto fail_syntax; if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) - goto fail; + goto fail_syntax; if (buf[0] == '\0') { pstrcpy(buf, sizeof(buf), "10.0.2.15"); } if (!inet_aton(buf, &guest_addr)) - goto fail; + goto fail_syntax; guest_port = strtol(p, &r, 0); if (r == p) - goto fail; + goto fail_syntax; if (slirp_redir(is_udp, host_port, guest_addr, guest_port) < 0) { - fprintf(stderr, "qemu: could not set up redirection\n"); - exit(1); + errmsg = "could not set up redirection\n"; + goto fail; } return; + + fail_syntax: + errmsg = "invalid redirection format\n"; fail: - fprintf(stderr, "qemu: syntax: -redir [tcp|udp]:host-port:[guest-host]:guest-port\n"); - exit(1); + if (0) { + term_printf(errmsg); + } else { + fprintf(stderr, "qemu: %s", errmsg); + exit(1); + } } #ifndef _WIN32
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor