Misc fixes

* Use correct constants for 'bool' type
 * Fix compatibility with noVNC in websocket impl
 * Remove inaccurate docs aout default NIC model
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE2vOm/bJrYpEtDo4/vobrtBUQT98FAl49VtkACgkQvobrtBUQ
 T9/oEA/+ICmmZzqfJoB7I5MmTUXfptbBVMbkmUdVXUlxMWubk2/VQlurW0Ek91EO
 TiqvY5afmdYm8Br0EzJNQoQR2Pe/Yki1r5ei385tFFIcVrfU/apKNKkC60y48eHc
 xjDDCdynHFGWCwjv2A2IllliHuXyPhLArB+3aq/ByY6ymyvJ3ZSFeRbAycjUTF1G
 mGIA1/jy3r6tXdb7OL7jTZL1S6esLYhXDIrl5hB+O16vy8/spSsZhTs4G69pHNX6
 M58oCvktR5DxXr+9pYBTjWWKWsGgfIYE7yiC30CwcveiTMWhLf7i8rcQrh1OGYzu
 UUKu2hqtJRAmgC9VllI85+f/sZq27ob/UVYyNFpCNaXWF3wIjEGKxMjheQLMhwAM
 6EP+lg5nj6XdpcQ3pmPjS2L7o3fDvnylrYbAjz4dxQtL887ec1yrEXLvgCCTP0Pi
 P7e8Y5TxNZiBkXbReof1NTqqLPPLMQAaKARMyRlnrzP6l6Ob4z8utTODMcuMiWY6
 BVQUe+BtWGw0KgmMGNtfJmLQOWXfD/jFXCNdt+YwRnWw6E3ryoUomSfJcmG7A3Qz
 JuVJwLKri8o8vgTzT4Vz+8bAHlxKIJZLW8sO1GN4tC1P3ISLspo/kHt28Z1R1eRl
 YjrYsWIFiF6QpXvl/1K1TavQRCJ2PuFPRna0PuoNaOXMmlrJwOo=
 =se4t
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/berrange/tags/misc-fixes-pull-request' into staging

Misc fixes

* Use correct constants for 'bool' type
* Fix compatibility with noVNC in websocket impl
* Remove inaccurate docs aout default NIC model

# gpg: Signature made Fri 07 Feb 2020 12:23:53 GMT
# gpg:                using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/misc-fixes-pull-request:
  docs: stop documenting the e1000 NIC model as the default
  authz: fix usage of bool in listfile.c
  io/channel-websock: treat 'binary' and no sub-protocol as the same

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-02-07 15:01:23 +00:00
commit 42ccca1bd9
3 changed files with 32 additions and 18 deletions

View File

@ -239,7 +239,7 @@ qauthz_list_file_init(Object *obj)
authz->file_watch = -1; authz->file_watch = -1;
#ifdef CONFIG_INOTIFY1 #ifdef CONFIG_INOTIFY1
authz->refresh = TRUE; authz->refresh = true;
#endif #endif
} }

View File

@ -49,7 +49,7 @@
"Server: QEMU VNC\r\n" \ "Server: QEMU VNC\r\n" \
"Date: %s\r\n" "Date: %s\r\n"
#define QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK \ #define QIO_CHANNEL_WEBSOCK_HANDSHAKE_WITH_PROTO_RES_OK \
"HTTP/1.1 101 Switching Protocols\r\n" \ "HTTP/1.1 101 Switching Protocols\r\n" \
QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_COMMON \ QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_COMMON \
"Upgrade: websocket\r\n" \ "Upgrade: websocket\r\n" \
@ -57,6 +57,13 @@
"Sec-WebSocket-Accept: %s\r\n" \ "Sec-WebSocket-Accept: %s\r\n" \
"Sec-WebSocket-Protocol: binary\r\n" \ "Sec-WebSocket-Protocol: binary\r\n" \
"\r\n" "\r\n"
#define QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK \
"HTTP/1.1 101 Switching Protocols\r\n" \
QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_COMMON \
"Upgrade: websocket\r\n" \
"Connection: Upgrade\r\n" \
"Sec-WebSocket-Accept: %s\r\n" \
"\r\n"
#define QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_NOT_FOUND \ #define QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_NOT_FOUND \
"HTTP/1.1 404 Not Found\r\n" \ "HTTP/1.1 404 Not Found\r\n" \
QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_COMMON \ QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_COMMON \
@ -336,6 +343,7 @@ qio_channel_websock_find_header(QIOChannelWebsockHTTPHeader *hdrs,
static void qio_channel_websock_handshake_send_res_ok(QIOChannelWebsock *ioc, static void qio_channel_websock_handshake_send_res_ok(QIOChannelWebsock *ioc,
const char *key, const char *key,
const bool use_protocols,
Error **errp) Error **errp)
{ {
char combined_key[QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN + char combined_key[QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
@ -361,8 +369,14 @@ static void qio_channel_websock_handshake_send_res_ok(QIOChannelWebsock *ioc,
} }
date = qio_channel_websock_date_str(); date = qio_channel_websock_date_str();
if (use_protocols) {
qio_channel_websock_handshake_send_res(
ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_WITH_PROTO_RES_OK,
date, accept);
} else {
qio_channel_websock_handshake_send_res( qio_channel_websock_handshake_send_res(
ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, date, accept); ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, date, accept);
}
g_free(date); g_free(date);
g_free(accept); g_free(accept);
@ -387,10 +401,6 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,
protocols = qio_channel_websock_find_header( protocols = qio_channel_websock_find_header(
hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL); hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL);
if (!protocols) {
error_setg(errp, "Missing websocket protocol header data");
goto bad_request;
}
version = qio_channel_websock_find_header( version = qio_channel_websock_find_header(
hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_VERSION); hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);
@ -430,11 +440,13 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,
trace_qio_channel_websock_http_request(ioc, protocols, version, trace_qio_channel_websock_http_request(ioc, protocols, version,
host, connection, upgrade, key); host, connection, upgrade, key);
if (protocols) {
if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) { if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) {
error_setg(errp, "No '%s' protocol is supported by client '%s'", error_setg(errp, "No '%s' protocol is supported by client '%s'",
QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols); QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols);
goto bad_request; goto bad_request;
} }
}
if (!g_str_equal(version, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) { if (!g_str_equal(version, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) {
error_setg(errp, "Version '%s' is not supported by client '%s'", error_setg(errp, "Version '%s' is not supported by client '%s'",
@ -467,7 +479,7 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,
goto bad_request; goto bad_request;
} }
qio_channel_websock_handshake_send_res_ok(ioc, key, errp); qio_channel_websock_handshake_send_res_ok(ioc, key, !!protocols, errp);
return; return;
bad_request: bad_request:

View File

@ -2428,8 +2428,7 @@ Use @option{model=help} to list the available device types.
The hardware MAC address can be set with @option{mac=@var{macaddr}}. The hardware MAC address can be set with @option{mac=@var{macaddr}}.
The following two example do exactly the same, to show how @option{-nic} can The following two example do exactly the same, to show how @option{-nic} can
be used to shorten the command line length (note that the e1000 is the default be used to shorten the command line length:
on i386, so the @option{model=e1000} parameter could even be omitted here, too):
@example @example
@value{qemu_system} -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32 @value{qemu_system} -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=52:54:98:76:54:32
@value{qemu_system} -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32 @value{qemu_system} -nic user,ipv6=off,model=e1000,mac=52:54:98:76:54:32
@ -2843,9 +2842,12 @@ netdev with ID @var{nd} by using the @option{netdev=@var{nd}} option.
Legacy option to configure or create an on-board (or machine default) Network Legacy option to configure or create an on-board (or machine default) Network
Interface Card(NIC) and connect it either to the emulated hub with ID 0 (i.e. Interface Card(NIC) and connect it either to the emulated hub with ID 0 (i.e.
the default hub), or to the netdev @var{nd}. the default hub), or to the netdev @var{nd}.
The NIC is an e1000 by default on the PC target. Optionally, the MAC address If @var{model} is omitted, then the default NIC model associated with
can be changed to @var{mac}, the device address set to @var{addr} (PCI cards the machine type is used. Note that the default NIC model may change in
only), and a @var{name} can be assigned for use in monitor commands. future QEMU releases, so it is highly recommended to always specify a model.
Optionally, the MAC address can be changed to @var{mac}, the device
address set to @var{addr} (PCI cards only), and a @var{name} can be
assigned for use in monitor commands.
Optionally, for PCI cards, you can specify the number @var{v} of MSI-X vectors Optionally, for PCI cards, you can specify the number @var{v} of MSI-X vectors
that the card should have; this option currently only affects virtio cards; set that the card should have; this option currently only affects virtio cards; set
@var{v} = 0 to disable MSI-X. If no @option{-net} option is specified, a single @var{v} = 0 to disable MSI-X. If no @option{-net} option is specified, a single