All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/3] Misc patches
@ 2020-02-07 12:24 Daniel P. Berrangé
  2020-02-07 12:24 ` [PULL 1/3] io/channel-websock: treat 'binary' and no sub-protocol as the same Daniel P. Berrangé
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2020-02-07 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel P. Berrangé

The following changes since commit 5b7686f3fa2092d2b3be92df67b5966ee1b0142a:

  Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-02-06' into staging (2020-02-06 18:59:12 +0000)

are available in the Git repository at:

  https://github.com/berrange/qemu tags/misc-fixes-pull-request

for you to fetch changes up to 416b71906edfcf280ef31d0e5e607898330b6271:

  docs: stop documenting the e1000 NIC model as the default (2020-02-07 12:22:19 +0000)

----------------------------------------------------------------

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

----------------------------------------------------------------

Daniel P. Berrangé (1):
  docs: stop documenting the e1000 NIC model as the default

Jafar Abdi (1):
  authz: fix usage of bool in listfile.c

yuchenlin (1):
  io/channel-websock: treat 'binary' and no sub-protocol as the same

 authz/listfile.c     |  2 +-
 io/channel-websock.c | 36 ++++++++++++++++++++++++------------
 qemu-options.hx      | 12 +++++++-----
 3 files changed, 32 insertions(+), 18 deletions(-)

-- 
2.24.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 1/3] io/channel-websock: treat 'binary' and no sub-protocol as the same
  2020-02-07 12:24 [PULL 0/3] Misc patches Daniel P. Berrangé
@ 2020-02-07 12:24 ` Daniel P. Berrangé
  2020-02-07 12:24 ` [PULL 2/3] authz: fix usage of bool in listfile.c Daniel P. Berrangé
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2020-02-07 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yu-Chen Lin, Daniel P. Berrangé

From: Yu-Chen Lin <npes87184@gmail.com>

noVNC doesn't use 'binary' protocol by default after
commit c912230309806aacbae4295faf7ad6406da97617.

It will cause qemu return 400 when handshaking.

To overcome this problem and remain compatibility of
older noVNC client.

We treat 'binary' and no sub-protocol as the same
so that we can support different version of noVNC
client.

Tested on noVNC before c912230 and after c912230.

Buglink: https://bugs.launchpad.net/qemu/+bug/1849644

Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 io/channel-websock.c | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/io/channel-websock.c b/io/channel-websock.c
index fc36d44eba..47a0e941d9 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -49,13 +49,20 @@
     "Server: QEMU VNC\r\n"                       \
     "Date: %s\r\n"
 
+#define QIO_CHANNEL_WEBSOCK_HANDSHAKE_WITH_PROTO_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"                      \
+    "Sec-WebSocket-Protocol: binary\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"              \
-    "Sec-WebSocket-Protocol: binary\r\n"        \
     "\r\n"
 #define QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_NOT_FOUND \
     "HTTP/1.1 404 Not Found\r\n"                    \
@@ -336,6 +343,7 @@ qio_channel_websock_find_header(QIOChannelWebsockHTTPHeader *hdrs,
 
 static void qio_channel_websock_handshake_send_res_ok(QIOChannelWebsock *ioc,
                                                       const char *key,
+                                                      const bool use_protocols,
                                                       Error **errp)
 {
     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();
-    qio_channel_websock_handshake_send_res(
-        ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, date, accept);
+    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(
+                ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, date, accept);
+    }
 
     g_free(date);
     g_free(accept);
@@ -387,10 +401,6 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,
 
     protocols = qio_channel_websock_find_header(
         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(
         hdrs, nhdrs, QIO_CHANNEL_WEBSOCK_HEADER_VERSION);
@@ -430,10 +440,12 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,
     trace_qio_channel_websock_http_request(ioc, protocols, version,
                                            host, connection, upgrade, key);
 
-    if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) {
-        error_setg(errp, "No '%s' protocol is supported by client '%s'",
-                   QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols);
-        goto bad_request;
+    if (protocols) {
+            if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) {
+                error_setg(errp, "No '%s' protocol is supported by client '%s'",
+                           QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols);
+                goto bad_request;
+            }
     }
 
     if (!g_str_equal(version, QIO_CHANNEL_WEBSOCK_SUPPORTED_VERSION)) {
@@ -467,7 +479,7 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,
         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;
 
  bad_request:
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 2/3] authz: fix usage of bool in listfile.c
  2020-02-07 12:24 [PULL 0/3] Misc patches Daniel P. Berrangé
  2020-02-07 12:24 ` [PULL 1/3] io/channel-websock: treat 'binary' and no sub-protocol as the same Daniel P. Berrangé
@ 2020-02-07 12:24 ` Daniel P. Berrangé
  2020-02-07 12:24 ` [PULL 3/3] docs: stop documenting the e1000 NIC model as the default Daniel P. Berrangé
  2020-02-07 18:02 ` [PULL 0/3] Misc patches Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2020-02-07 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jafar Abdi, Daniel P. Berrangé

From: Jafar Abdi <cafer.abdi@gmail.com>

Clean up wrong usage of FALSE and TRUE in places that use "bool" from stdbool.h.

FALSE and TRUE (with capital letters) are the constants defined by glib for
being used with the "gboolean" type of glib. But some parts of the code also use
TRUE and FALSE for variables that are declared as "bool" (the type from <stdbool.h>).

Signed-off-by: Jafar Abdi <cafer.abdi@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 authz/listfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/authz/listfile.c b/authz/listfile.c
index e7a8c19bcb..b71f57d30a 100644
--- a/authz/listfile.c
+++ b/authz/listfile.c
@@ -239,7 +239,7 @@ qauthz_list_file_init(Object *obj)
 
     authz->file_watch = -1;
 #ifdef CONFIG_INOTIFY1
-    authz->refresh = TRUE;
+    authz->refresh = true;
 #endif
 }
 
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 3/3] docs: stop documenting the e1000 NIC model as the default
  2020-02-07 12:24 [PULL 0/3] Misc patches Daniel P. Berrangé
  2020-02-07 12:24 ` [PULL 1/3] io/channel-websock: treat 'binary' and no sub-protocol as the same Daniel P. Berrangé
  2020-02-07 12:24 ` [PULL 2/3] authz: fix usage of bool in listfile.c Daniel P. Berrangé
@ 2020-02-07 12:24 ` Daniel P. Berrangé
  2020-02-07 18:02 ` [PULL 0/3] Misc patches Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2020-02-07 12:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Daniel P. Berrangé

The default NIC model for QEMU varies per machine type, and is liable to
change across machine type versions. Documenting e1000 NIC as the
default for PC/i386 is thus misleading to users at best. In particular
the PC q35 machine type switched to use e1000e, but only in machine
type versions after 2.11.

Rather than try to explain which NIC model is used for each machine
type version, remove mention of e1000 as the default, and steer users
towards always specifying their desired model.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 qemu-options.hx | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index ff3e806977..ac315c1ac4 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -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 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
-on i386, so the @option{model=e1000} parameter could even be omitted here, too):
+be used to shorten the command line length:
 @example
 @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
@@ -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
 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 NIC is an e1000 by default on the PC target. 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.
+If @var{model} is omitted, then the default NIC model associated with
+the machine type is used. Note that the default NIC model may change in
+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
 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
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PULL 0/3] Misc patches
  2020-02-07 12:24 [PULL 0/3] Misc patches Daniel P. Berrangé
                   ` (2 preceding siblings ...)
  2020-02-07 12:24 ` [PULL 3/3] docs: stop documenting the e1000 NIC model as the default Daniel P. Berrangé
@ 2020-02-07 18:02 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2020-02-07 18:02 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: QEMU Developers

On Fri, 7 Feb 2020 at 12:25, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> The following changes since commit 5b7686f3fa2092d2b3be92df67b5966ee1b0142a:
>
>   Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-02-06' into staging (2020-02-06 18:59:12 +0000)
>
> are available in the Git repository at:
>
>   https://github.com/berrange/qemu tags/misc-fixes-pull-request
>
> for you to fetch changes up to 416b71906edfcf280ef31d0e5e607898330b6271:
>
>   docs: stop documenting the e1000 NIC model as the default (2020-02-07 12:22:19 +0000)
>
> ----------------------------------------------------------------
>
> * Use correct constants for 'bool' type
> * Fix compatibility with noVNC in websocket impl
> * Remove inaccurate docs aout default NIC model
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-07 18:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07 12:24 [PULL 0/3] Misc patches Daniel P. Berrangé
2020-02-07 12:24 ` [PULL 1/3] io/channel-websock: treat 'binary' and no sub-protocol as the same Daniel P. Berrangé
2020-02-07 12:24 ` [PULL 2/3] authz: fix usage of bool in listfile.c Daniel P. Berrangé
2020-02-07 12:24 ` [PULL 3/3] docs: stop documenting the e1000 NIC model as the default Daniel P. Berrangé
2020-02-07 18:02 ` [PULL 0/3] Misc patches Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.