chardev: forbid 'wait' option with client sockets
The 'wait'/'nowait' parameter is used to tell server sockets whether to block until a client is accepted during initialization. Client chardevs have always silently ignored this option. Various tests were mistakenly passing this option for their client chardevs. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20190211182442.8542-6-berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
4a0582f656
commit
767abe7f49
@ -1047,6 +1047,12 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock,
|
|||||||
error_setg(errp, "%s", "Websocket client is not implemented");
|
error_setg(errp, "%s", "Websocket client is not implemented");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (sock->has_wait) {
|
||||||
|
error_setg(errp, "%s",
|
||||||
|
"'wait' option is incompatible with "
|
||||||
|
"socket in client connect mode");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1220,7 +1226,11 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend,
|
|||||||
sock->tn3270 = is_tn3270;
|
sock->tn3270 = is_tn3270;
|
||||||
sock->has_websocket = true;
|
sock->has_websocket = true;
|
||||||
sock->websocket = is_websock;
|
sock->websocket = is_websock;
|
||||||
sock->has_wait = true;
|
/*
|
||||||
|
* We have different default to QMP for 'wait' when 'server'
|
||||||
|
* is set, hence we can't just check for existence of 'wait'
|
||||||
|
*/
|
||||||
|
sock->has_wait = qemu_opt_find(opts, "wait") || is_listen;
|
||||||
sock->wait = is_waitconnect;
|
sock->wait = is_waitconnect;
|
||||||
sock->has_reconnect = qemu_opt_find(opts, "reconnect");
|
sock->has_reconnect = qemu_opt_find(opts, "reconnect");
|
||||||
sock->reconnect = reconnect;
|
sock->reconnect = reconnect;
|
||||||
|
@ -295,7 +295,7 @@ static void setup_vm_with_server(IVState *s, int nvectors)
|
|||||||
{
|
{
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
cmd = g_strdup_printf("-chardev socket,id=chr0,path=%s,nowait "
|
cmd = g_strdup_printf("-chardev socket,id=chr0,path=%s "
|
||||||
"-device ivshmem-doorbell,chardev=chr0,vectors=%d",
|
"-device ivshmem-doorbell,chardev=chr0,vectors=%d",
|
||||||
tmpserver, nvectors);
|
tmpserver, nvectors);
|
||||||
|
|
||||||
|
@ -232,9 +232,9 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
|
|||||||
qtest_add_abrt_handler(kill_qemu_hook_func, s);
|
qtest_add_abrt_handler(kill_qemu_hook_func, s);
|
||||||
|
|
||||||
command = g_strdup_printf("exec %s "
|
command = g_strdup_printf("exec %s "
|
||||||
"-qtest unix:%s,nowait "
|
"-qtest unix:%s "
|
||||||
"-qtest-log %s "
|
"-qtest-log %s "
|
||||||
"-chardev socket,path=%s,nowait,id=char0 "
|
"-chardev socket,path=%s,id=char0 "
|
||||||
"-mon chardev=char0,mode=control "
|
"-mon chardev=char0,mode=control "
|
||||||
"-machine accel=qtest "
|
"-machine accel=qtest "
|
||||||
"-display none "
|
"-display none "
|
||||||
|
@ -96,7 +96,7 @@ static void test_redirector_tx(void)
|
|||||||
"-device %s,netdev=qtest-bn0,id=qtest-e0 "
|
"-device %s,netdev=qtest-bn0,id=qtest-e0 "
|
||||||
"-chardev socket,id=redirector0,path=%s,server,nowait "
|
"-chardev socket,id=redirector0,path=%s,server,nowait "
|
||||||
"-chardev socket,id=redirector1,path=%s,server,nowait "
|
"-chardev socket,id=redirector1,path=%s,server,nowait "
|
||||||
"-chardev socket,id=redirector2,path=%s,nowait "
|
"-chardev socket,id=redirector2,path=%s "
|
||||||
"-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
|
"-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
|
||||||
"queue=tx,outdev=redirector0 "
|
"queue=tx,outdev=redirector0 "
|
||||||
"-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
|
"-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
|
||||||
@ -166,7 +166,7 @@ static void test_redirector_rx(void)
|
|||||||
"-device %s,netdev=qtest-bn0,id=qtest-e0 "
|
"-device %s,netdev=qtest-bn0,id=qtest-e0 "
|
||||||
"-chardev socket,id=redirector0,path=%s,server,nowait "
|
"-chardev socket,id=redirector0,path=%s,server,nowait "
|
||||||
"-chardev socket,id=redirector1,path=%s,server,nowait "
|
"-chardev socket,id=redirector1,path=%s,server,nowait "
|
||||||
"-chardev socket,id=redirector2,path=%s,nowait "
|
"-chardev socket,id=redirector2,path=%s "
|
||||||
"-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
|
"-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
|
||||||
"queue=rx,indev=redirector0 "
|
"queue=rx,indev=redirector0 "
|
||||||
"-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
|
"-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
|
||||||
|
Loading…
Reference in New Issue
Block a user