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");
}
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;
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);
}
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));
}