diff --git a/net.c b/net.c index 6cd63aa73371e894f87991baf7a8edcf03ae623e..2cfdd308d34d12fbd8adbbdf9f85b8547ce02739 100644 --- a/net.c +++ b/net.c @@ -3231,11 +3231,12 @@ int net_init_clients(void) return 0; } -int net_client_parse(const char *optarg) +int net_client_parse(QemuOptsList *opts_list, const char *optarg) { #if defined(CONFIG_SLIRP) /* handle legacy -net channel,port:chr */ - if (!strncmp(optarg, "channel,", strlen("channel,"))) { + if (!strcmp(opts_list->name, "net") && + !strncmp(optarg, "channel,", strlen("channel,"))) { int ret; optarg += strlen("channel,"); @@ -3256,7 +3257,7 @@ int net_client_parse(const char *optarg) return ret; } #endif - if (!qemu_opts_parse(&qemu_net_opts, optarg, "type")) { + if (!qemu_opts_parse(opts_list, optarg, "type")) { return -1; } diff --git a/net.h b/net.h index 79e9b474270745d8f50a395e736f03363fe3ddb4..404190cb86d8aa9feb1db0070dea65da6d415104 100644 --- a/net.h +++ b/net.h @@ -136,7 +136,7 @@ extern const char *legacy_bootp_filename; int net_client_init(Monitor *mon, QemuOpts *opts); void net_client_uninit(NICInfo *nd); -int net_client_parse(const char *str); +int net_client_parse(QemuOptsList *opts_list, const char *str); int net_init_clients(void); int net_slirp_smb(const char *exported_dir); void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict); diff --git a/vl.c b/vl.c index afe01af9d7574a60cf95a1b3a7dad77b0de8e406..a4f7edfbb46db6a7c814d899fd24163f5cf05cd7 100644 --- a/vl.c +++ b/vl.c @@ -5088,7 +5088,7 @@ int main(int argc, char **argv, char **envp) break; #endif case QEMU_OPTION_net: - if (net_client_parse(optarg) == -1) { + if (net_client_parse(&qemu_net_opts, optarg) == -1) { exit(1); } break;