Skip to contentSkip to conversation

Allow UNIX socket for VNC websocket

PATCH In review Sergii Zasenko 3 participants 6 messages Jul 23, 2023 – Jul 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow UNIX socket for VNC websocket

---
 ui/vnc.c | 5 -----
 1 file changed, 5 deletions(-)
ui/vnc.c +0 -5
index 92964dc..dea1414 100644
@@ -3715,11 +3715,6 @@ static int vnc_display_get_address(const char *addrstr,
         addr->type = SOCKET_ADDRESS_TYPE_UNIX;
         addr->u.q_unix.path = g_strdup(addrstr + 5);
 
-        if (websocket) {
-            error_setg(errp, "UNIX sockets not supported with websock");
-            goto cleanup;
-        }
-
         if (to) {
             error_setg(errp, "Port range not support with UNIX socket");
             goto cleanup;
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw

Hi

Daniel, in commit 275e0d616b ("ui: refactor code for populating SocketAddress from vnc_display_open"), you said "This refactoring also removes the restriction that prevents enabling websockets when the plain VNC server is listening on a UNIX socket.". But you didn't remove the condition. I suppose it was a left-over?

Quoted 2 lines · Sergii Zasenko

lgtm

Quoted 26 lines
---
 ui/vnc.c | 5 -----
 1 file changed, 5 deletions(-)
ui/vnc.c +0 -5
index 92964dc..dea1414 100644
@@ -3715,11 +3715,6 @@ static int vnc_display_get_address(const char
 *addrstr,
         addr->type = SOCKET_ADDRESS_TYPE_UNIX;
         addr->u.q_unix.path = g_strdup(addrstr + 5);
 
-        if (websocket) {
-            error_setg(errp, "UNIX sockets not supported with websock");
-            goto cleanup;
-        }
-
         if (to) {
             error_setg(errp, "Port range not support with UNIX socket");
             goto cleanup;

--
2.39.2

Signature · 1 line
Marc-André Lureau
#2 lore raw
Quoted 7 lines · Marc-André Lureau

Hi

Daniel, in commit 275e0d616b ("ui: refactor code for populating SocketAddress from vnc_display_open"), you said "This refactoring also removes the restriction that prevents enabling websockets when the plain VNC server is listening on a UNIX socket.". But you didn't remove the condition. I suppose it was a left-over?

That commit was allowing the regular VNC port to be put on UNIX socket, at the same time as WS was enabled, it wasn't trying to put WS on a UNIX socket. Still I seee no reason to keep the limitation.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw
In reply to Sergii Zasenko
Quoted 11 lines · Sergii Zasenko
---
 ui/vnc.c | 5 -----
 1 file changed, 5 deletions(-)
ui/vnc.c +0 -0
index 92964dc..dea1414 100644
@@ -3715,11 +3715,6 @@ static int vnc_display_get_address(const char *addrstr,
         addr->type = SOCKET_ADDRESS_TYPE_UNIX;

ui/vnc.c static int vnc_display_get_address(const char *addrstr, · line 3720

Quoted 10 lines
ui/vnc.c +0 -5
         addr->u.q_unix.path = g_strdup(addrstr + 5);
 
-        if (websocket) {
-            error_setg(errp, "UNIX sockets not supported with websock");
-            goto cleanup;
-        }
-
         if (to) {
             error_setg(errp, "Port range not support with UNIX socket");
             goto cleanup;

Missing docs update to qemu-options.hx to describe the permitted syntax for the new feature.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#4 lore raw

PATCH 1/1 Allow UNIX socket option for VNC websocket

- Remove unix socket option limitation for VNC websocket
- Reflect websocket option changes in documentation

---
 qemu-options.hx | 4 ++++
 ui/vnc.c        | 5 -----
 2 files changed, 4 insertions(+), 5 deletions(-)
qemu-options.hx +4 -0
index 29b98c3..8cc910d 100644
@@ -2451,6 +2451,10 @@ SRST
         host. It is possible to control the websocket listen address
         independently, using the syntax ``websocket``\ =host:port.
 
+        Websocket could be allowed over UNIX domain socket, using the syntax
+        ``websocket``\ =unix:path, where path is the location of a unix socket
+        to listen for connections on.
+
         If no TLS credentials are provided, the websocket connection
         runs in unencrypted mode. If TLS credentials are provided, the
         websocket connection requires encrypted client connections.
ui/vnc.c +0 -5
index 92964dc..dea1414 100644
@@ -3715,11 +3715,6 @@ static int vnc_display_get_address(const char *addrstr,
         addr->type = SOCKET_ADDRESS_TYPE_UNIX;
         addr->u.q_unix.path = g_strdup(addrstr + 5);
 
-        if (websocket) {
-            error_setg(errp, "UNIX sockets not supported with websock");
-            goto cleanup;
-        }
-
         if (to) {
             error_setg(errp, "Port range not support with UNIX socket");
             goto cleanup;
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#5 lore raw

Re: [PATCH] Allow UNIX socket option for VNC websocket

Quoted 5 lines · Sergii Zasenko

- Remove unix socket option limitation for VNC websocket
- Reflect websocket option changes in documentation

Quoted 44 lines
---
 qemu-options.hx | 4 ++++
 ui/vnc.c        | 5 -----
 2 files changed, 4 insertions(+), 5 deletions(-)
qemu-options.hx +1 -0
index 29b98c3..8cc910d 100644
@@ -2451,6 +2451,10 @@ SRST
         host. It is possible to control the websocket listen address
         independently, using the syntax ``websocket``\ =host:port.
 
+        Websocket could be allowed over UNIX domain socket, using the

syntax
+ ``websocket``\ =unix:path, where path is the location of a unix
socket

qemu-options.hx +2 -0
+        to listen for connections on.
+
         If no TLS credentials are provided, the websocket connection
         runs in unencrypted mode. If TLS credentials are provided, the
         websocket connection requires encrypted client connections.
ui/vnc.c +0 -5
index 92964dc..dea1414 100644
@@ -3715,11 +3715,6 @@ static int vnc_display_get_address(const char
 *addrstr,
         addr->type = SOCKET_ADDRESS_TYPE_UNIX;
         addr->u.q_unix.path = g_strdup(addrstr + 5);
 
-        if (websocket) {
-            error_setg(errp, "UNIX sockets not supported with websock");
-            goto cleanup;
-        }
-
         if (to) {
             error_setg(errp, "Port range not support with UNIX socket");
             goto cleanup;

--
2.39.2

Signature · 1 line
Marc-André Lureau