slirp_input(buf, size);
}
+static int slirp_in_use;
+
+static void net_slirp_cleanup(VLANClientState *vc)
+{
+ slirp_in_use = 0;
+}
+
static int net_slirp_init(VLANState *vlan, const char *model, const char *name)
{
+ if (slirp_in_use) {
+ /* slirp only supports a single instance so far */
+ return -1;
+ }
if (!slirp_inited) {
slirp_inited = 1;
slirp_init(slirp_restrict, slirp_ip);
}
slirp_vc = qemu_new_vlan_client(vlan, model, name,
- slirp_receive, NULL, NULL, NULL);
+ slirp_receive, NULL, net_slirp_cleanup, NULL);
slirp_vc->info_str[0] = '\0';
+ slirp_in_use = 1;
return 0;
}
errmsg = "invalid redirection format\n";
fail:
if (mon) {
- monitor_printf(mon, errmsg);
+ monitor_printf(mon, "%s", errmsg);
} else {
fprintf(stderr, "qemu: %s", errmsg);
exit(1);
monitor_printf(mon, "invalid host network device %s\n", device);
return;
}
- if (net_client_init(device, opts ? : "") < 0) {
+ if (net_client_init(device, opts ? opts : "") < 0) {
monitor_printf(mon, "adding host network device %s failed\n", device);
}
}