diff options
Diffstat (limited to 'net/slirp.c')
-rw-r--r-- | net/slirp.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/slirp.c b/net/slirp.c index f98425ee9f..ec07f662c0 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -704,8 +704,8 @@ static int slirp_smb(SlirpState* s, const char *exported_dir, CONFIG_SMBD_COMMAND, s->smb_dir, smb_conf); g_free(smb_conf); - if (slirp_add_exec(s->slirp, NULL, smb_cmdline, &vserver_addr, 139) < 0 || - slirp_add_exec(s->slirp, NULL, smb_cmdline, &vserver_addr, 445) < 0) { + if (slirp_add_exec(s->slirp, smb_cmdline, &vserver_addr, 139) < 0 || + slirp_add_exec(s->slirp, smb_cmdline, &vserver_addr, 445) < 0) { slirp_smb_cleanup(s); g_free(smb_cmdline); error_setg(errp, "Conflicting/invalid smbserver address"); @@ -736,6 +736,11 @@ static void guestfwd_read(void *opaque, const uint8_t *buf, int size) slirp_socket_recv(fwd->slirp, fwd->server, fwd->port, buf, size); } +static int guestfwd_write(const void *buf, size_t len, void *chr) +{ + return qemu_chr_fe_write_all(chr, buf, len); +} + static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp) { struct in_addr server = { .s_addr = 0 }; @@ -769,7 +774,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp) snprintf(buf, sizeof(buf), "guestfwd.tcp.%d", port); if ((strlen(p) > 4) && !strncmp(p, "cmd:", 4)) { - if (slirp_add_exec(s->slirp, NULL, &p[4], &server, port) < 0) { + if (slirp_add_exec(s->slirp, &p[4], &server, port) < 0) { error_setg(errp, "Conflicting/invalid host:port in guest " "forwarding rule '%s'", config_str); return -1; @@ -796,7 +801,8 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp) return -1; } - if (slirp_add_exec(s->slirp, &fwd->hd, NULL, &server, port) < 0) { + if (slirp_add_guestfwd(s->slirp, guestfwd_write, &fwd->hd, + &server, port) < 0) { error_setg(errp, "Conflicting/invalid host:port in guest " "forwarding rule '%s'", config_str); g_free(fwd); |