aboutsummaryrefslogtreecommitdiffstats
path: root/main/xen/qemu-xen-websocket.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/xen/qemu-xen-websocket.patch')
-rw-r--r--main/xen/qemu-xen-websocket.patch225
1 files changed, 127 insertions, 98 deletions
diff --git a/main/xen/qemu-xen-websocket.patch b/main/xen/qemu-xen-websocket.patch
index 4e54d7e213..02bb805dac 100644
--- a/main/xen/qemu-xen-websocket.patch
+++ b/main/xen/qemu-xen-websocket.patch
@@ -1,36 +1,26 @@
---- xen-4.2.2.orig/tools/Makefile
-+++ xen-4.2.2/tools/Makefile
-@@ -202,6 +202,7 @@
+--- xen-4.3.0.orig/tools/Makefile
++++ xen-4.3.0/tools/Makefile
+@@ -203,6 +203,7 @@
--docdir=$(PREFIX)/share/doc \
--sysconfdir=/etc/qemu \
--disable-kvm \
+ --enable-vnc-ws \
+ --disable-docs \
--python=$(PYTHON) \
$(IOEMU_CONFIGURE_CROSS); \
- $(MAKE) all
---- xen-4.2.2.orig/tools/qemu-xen/Makefile.objs
-+++ xen-4.2.2/tools/qemu-xen/Makefile.objs
-@@ -149,6 +149,7 @@
- vnc-obj-y += vnc-enc-zrle.o
- vnc-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o
- vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
-+vnc-obj-$(CONFIG_VNC_WS) += vnc-ws.o
- ifdef CONFIG_VNC_THREAD
- vnc-obj-y += vnc-jobs-async.o
- else
---- xen-4.2.2.orig/tools/qemu-xen/configure
-+++ xen-4.2.2/tools/qemu-xen/configure
-@@ -124,6 +124,7 @@
+--- xen-4.3.0.orig/tools/qemu-xen/configure
++++ xen-4.3.0/tools/qemu-xen/configure
+@@ -158,6 +158,7 @@
vnc_sasl=""
vnc_jpeg=""
vnc_png=""
+vnc_ws=""
- vnc_thread="no"
xen=""
xen_ctrl_version=""
-@@ -638,6 +639,10 @@
+ xen_pci_passthrough=""
+@@ -703,6 +704,10 @@
;;
- --enable-vnc-thread) vnc_thread="yes"
+ --enable-vnc-png) vnc_png="yes"
;;
+ --disable-vnc-ws) vnc_ws="no"
+ ;;
@@ -39,16 +29,16 @@
--disable-slirp) slirp="no"
;;
--disable-uuid) uuid="no"
-@@ -1008,6 +1013,8 @@
+@@ -1048,6 +1053,8 @@
+ echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
+ echo " --disable-vnc-png disable PNG compression for VNC server (default)"
echo " --enable-vnc-png enable PNG compression for VNC server"
- echo " --disable-vnc-thread disable threaded VNC server"
- echo " --enable-vnc-thread enable threaded VNC server"
+echo " --disable-vnc-ws disable Websockets support for VNC server"
+echo " --enable-vnc-ws enable Websockets support for VNC server"
echo " --disable-curses disable curses output"
echo " --enable-curses enable curses output"
echo " --disable-curl disable curl connectivity"
-@@ -1554,8 +1561,8 @@
+@@ -1692,8 +1699,8 @@
fi
##########################################
@@ -59,7 +49,7 @@
cat > $TMPC <<EOF
#include <gnutls/gnutls.h>
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
-@@ -1563,13 +1570,22 @@
+@@ -1701,13 +1708,22 @@
vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
@@ -83,18 +73,18 @@
fi
fi
-@@ -2864,6 +2880,7 @@
+@@ -3209,6 +3225,7 @@
echo "VNC SASL support $vnc_sasl"
echo "VNC JPEG support $vnc_jpeg"
echo "VNC PNG support $vnc_png"
+ echo "VNC WS support $vnc_ws"
- echo "VNC thread $vnc_thread"
fi
if test -n "$sparc_cpu"; then
-@@ -3053,6 +3070,10 @@
- fi
- if test "$vnc_thread" = "yes" ; then
- echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
+ echo "Target Sparc Arch $sparc_cpu"
+@@ -3384,6 +3401,10 @@
+ if test "$vnc_png" = "yes" ; then
+ echo "CONFIG_VNC_PNG=y" >> $config_host_mak
+ echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
+fi
+if test "$vnc_ws" = "yes" ; then
+ echo "CONFIG_VNC_WS=y" >> $config_host_mak
@@ -102,9 +92,9 @@
fi
if test "$fnmatch" = "yes" ; then
echo "CONFIG_FNMATCH=y" >> $config_host_mak
---- xen-4.2.2.orig/tools/qemu-xen/qemu-options.hx
-+++ xen-4.2.2/tools/qemu-xen/qemu-options.hx
-@@ -976,6 +976,14 @@
+--- xen-4.3.0.orig/tools/qemu-xen/qemu-options.hx
++++ xen-4.3.0/tools/qemu-xen/qemu-options.hx
+@@ -1096,6 +1096,14 @@
connections (@var{host}:@var{d},@code{reverse}), the @var{d} argument
is a TCP port number, not a display number.
@@ -119,8 +109,46 @@
@item password
Require that password based authentication is used for client connections.
+--- xen-4.3.0.orig/tools/qemu-xen/qemu-options.hx.orig
++++ xen-4.3.0/tools/qemu-xen/qemu-options.hx.orig
+@@ -2045,18 +2045,13 @@
+ devices.
+
+ Syntax for specifying a sheepdog device
+-@table @list
+-``sheepdog:<vdiname>''
+-
+-``sheepdog:<vdiname>:<snapid>''
+-
+-``sheepdog:<vdiname>:<tag>''
+-
+-``sheepdog:<host>:<port>:<vdiname>''
+-
+-``sheepdog:<host>:<port>:<vdiname>:<snapid>''
+-
+-``sheepdog:<host>:<port>:<vdiname>:<tag>''
++@table @code
++@item sheepdog:<vdiname>
++@item sheepdog:<vdiname>:<snapid>
++@item sheepdog:<vdiname>:<tag>
++@item sheepdog:<host>:<port>:<vdiname>
++@item sheepdog:<host>:<port>:<vdiname>:<snapid>
++@item sheepdog:<host>:<port>:<vdiname>:<tag>
+ @end table
+
+ Example
+--- xen-4.3.0.orig/tools/qemu-xen/ui/Makefile.objs
++++ xen-4.3.0/tools/qemu-xen/ui/Makefile.objs
+@@ -4,6 +4,7 @@
+ vnc-obj-y += vnc-enc-zrle.o
+ vnc-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o
+ vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
++vnc-obj-$(CONFIG_VNC_WS) += vnc-ws.o
+ vnc-obj-y += vnc-jobs.o
+
+ common-obj-y += keymaps.o
--- /dev/null
-+++ xen-4.2.2/tools/qemu-xen/ui/vnc-ws.c
++++ xen-4.3.0/tools/qemu-xen/ui/vnc-ws.c
@@ -0,0 +1,284 @@
+/*
+ * QEMU VNC display driver: Websockets support
@@ -407,7 +435,7 @@
+ return 1;
+}
--- /dev/null
-+++ xen-4.2.2/tools/qemu-xen/ui/vnc-ws.h
++++ xen-4.3.0/tools/qemu-xen/ui/vnc-ws.h
@@ -0,0 +1,86 @@
+/*
+ * QEMU VNC display driver: Websockets support
@@ -495,9 +523,9 @@
+ size_t *payload_size, size_t *frame_size);
+
+#endif /* __QEMU_UI_VNC_WS_H */
---- xen-4.2.2.orig/tools/qemu-xen/ui/vnc.c
-+++ xen-4.2.2/tools/qemu-xen/ui/vnc.c
-@@ -391,7 +391,6 @@
+--- xen-4.3.0.orig/tools/qemu-xen/ui/vnc.c
++++ xen-4.3.0/tools/qemu-xen/ui/vnc.c
+@@ -420,7 +420,6 @@
static int vnc_update_client(VncState *vs, int has_dirty);
static int vnc_update_client_sync(VncState *vs, int has_dirty);
static void vnc_disconnect_start(VncState *vs);
@@ -505,7 +533,7 @@
static void vnc_init_timer(VncDisplay *vd);
static void vnc_remove_timer(VncDisplay *vd);
-@@ -479,6 +478,13 @@
+@@ -510,6 +509,13 @@
buffer->offset += len;
}
@@ -519,7 +547,7 @@
static void vnc_desktop_resize(VncState *vs)
{
DisplayState *ds = vs->ds;
-@@ -1002,7 +1008,7 @@
+@@ -1016,7 +1022,7 @@
vs->csock = -1;
}
@@ -528,7 +556,7 @@
{
int i;
-@@ -1013,6 +1019,10 @@
+@@ -1027,6 +1033,10 @@
buffer_free(&vs->input);
buffer_free(&vs->output);
@@ -539,7 +567,7 @@
qobject_decref(vs->info);
-@@ -1150,8 +1160,7 @@
+@@ -1166,8 +1176,7 @@
if (!ret)
return 0;
@@ -549,7 +577,7 @@
if (vs->output.offset == 0) {
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
-@@ -1177,7 +1186,16 @@
+@@ -1193,7 +1202,16 @@
vnc_client_write_sasl(vs);
} else
#endif /* CONFIG_VNC_SASL */
@@ -567,7 +595,7 @@
}
void vnc_client_write(void *opaque)
-@@ -1185,7 +1203,11 @@
+@@ -1201,7 +1219,11 @@
VncState *vs = opaque;
vnc_lock_output(vs);
@@ -580,7 +608,7 @@
vnc_client_write_locked(opaque);
} else if (vs->csock != -1) {
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
-@@ -1273,7 +1295,21 @@
+@@ -1295,7 +1317,21 @@
ret = vnc_client_read_sasl(vs);
else
#endif /* CONFIG_VNC_SASL */
@@ -602,7 +630,7 @@
if (!ret) {
if (vs->csock == -1)
vnc_disconnect_finish(vs);
-@@ -1291,8 +1327,7 @@
+@@ -1313,8 +1349,7 @@
}
if (!ret) {
@@ -612,7 +640,7 @@
} else {
vs->read_handler_expect = ret;
}
-@@ -1345,7 +1380,11 @@
+@@ -1367,7 +1402,11 @@
void vnc_flush(VncState *vs)
{
vnc_lock_output(vs);
@@ -625,7 +653,7 @@
vnc_client_write_locked(vs);
}
vnc_unlock_output(vs);
-@@ -2525,7 +2564,7 @@
+@@ -2657,7 +2696,7 @@
}
}
@@ -634,7 +662,7 @@
{
VncState *vs = g_malloc0(sizeof(VncState));
int i;
-@@ -2552,12 +2591,33 @@
+@@ -2684,13 +2723,34 @@
VNC_DEBUG("New client on socket %d\n", csock);
dcl->idle = 0;
socket_set_nonblock(vs->csock);
@@ -651,6 +679,7 @@
vnc_client_cache_addr(vs);
vnc_qmp_event(vs, QEVENT_VNC_CONNECTED);
+ vnc_set_share_mode(vs, VNC_SHARE_MODE_CONNECTING);
vs->vd = vd;
+
@@ -669,7 +698,7 @@
vs->ds = vd->ds;
vs->last_x = -1;
vs->last_y = -1;
-@@ -2590,21 +2650,41 @@
+@@ -2722,21 +2782,41 @@
/* vs might be free()ed here */
}
@@ -714,7 +743,7 @@
void vnc_display_init(DisplayState *ds)
{
VncDisplay *vs = g_malloc0(sizeof(*vs));
-@@ -2616,6 +2696,9 @@
+@@ -2748,6 +2828,9 @@
vnc_display = vs;
vs->lsock = -1;
@@ -724,7 +753,7 @@
vs->ds = ds;
QTAILQ_INIT(&vs->clients);
-@@ -2659,6 +2742,15 @@
+@@ -2789,6 +2872,15 @@
close(vs->lsock);
vs->lsock = -1;
}
@@ -740,7 +769,7 @@
vs->auth = VNC_AUTH_INVALID;
#ifdef CONFIG_VNC_TLS
vs->subauth = VNC_AUTH_INVALID;
-@@ -2769,6 +2861,36 @@
+@@ -2910,6 +3002,36 @@
} else if (strncmp(options, "sasl", 4) == 0) {
sasl = 1; /* Require SASL auth */
#endif
@@ -777,23 +806,30 @@
#ifdef CONFIG_VNC_TLS
} else if (strncmp(options, "tls", 3) == 0) {
tls = 1; /* Require TLS */
-@@ -2931,7 +3053,10 @@
- } else {
- int csock = vs->lsock;
- vs->lsock = -1;
-- vnc_connect(vs, csock, 0);
+@@ -3068,6 +3190,9 @@
+ /* connect to viewer */
+ int csock;
+ vs->lsock = -1;
+#ifdef CONFIG_VNC_WS
-+ vs->lwebsock = -1;
++ vs->lwebsock = -1;
+#endif
-+ vnc_connect(vs, csock, 0, 0);
+ if (strncmp(display, "unix:", 5) == 0) {
+ csock = unix_connect(display+5, errp);
+ } else {
+@@ -3076,7 +3201,7 @@
+ if (csock < 0) {
+ goto fail;
}
- return 0;
-
-@@ -2944,21 +3069,56 @@
- vs->lsock = unix_listen(display+5, dpy+5, 256-5);
+- vnc_connect(vs, csock, 0);
++ vnc_connect(vs, csock, 0, 0);
+ } else {
+ /* listen for connects */
+ char *dpy;
+@@ -3087,25 +3212,54 @@
} else {
- vs->lsock = inet_listen(display, dpy, 256, SOCK_STREAM, 5900);
-+ if (-1 == vs->lsock) {
+ vs->lsock = inet_listen(display, dpy, 256,
+ SOCK_STREAM, 5900, errp);
++ if (vs->lsock < 0) {
+ g_free(dpy);
+ goto fail;
+ }
@@ -818,45 +854,41 @@
+ }
+#endif /* CONFIG_VNC_WS */
}
-- if (-1 == vs->lsock) {
+- if (vs->lsock < 0) {
- g_free(dpy);
-- return -1;
-- } else {
-- g_free(vs->display);
-- vs->display = dpy;
-+ g_free(vs->display);
-+ vs->display = dpy;
-+
+- goto fail;
+- }
+ g_free(vs->display);
+ vs->display = dpy;
+- qemu_set_fd_handler2(vs->lsock, NULL, vnc_listen_read, NULL, vs);
+ qemu_set_fd_handler2(vs->lsock, NULL, vnc_listen_regular_read, NULL, vs);
+#ifdef CONFIG_VNC_WS
+ if (vs->websocket) {
+ qemu_set_fd_handler2(vs->lwebsock, NULL, vnc_listen_websocket_read, NULL, vs);
- }
++ }
+#endif
}
-- return qemu_set_fd_handler2(vs->lsock, NULL, vnc_listen_read, NULL, vs);
-+ return 0;
-+
-+fail:
-+ g_free(vs->display);
-+ vs->display = NULL;
+ return;
+
+ fail:
+ g_free(vs->display);
+ vs->display = NULL;
+#ifdef CONFIG_VNC_WS
+ g_free(vs->ws_display);
+ vs->ws_display = NULL;
+#endif /* CONFIG_VNC_WS */
-+ return -1;
}
void vnc_display_add_client(DisplayState *ds, int csock, int skipauth)
{
VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
-- return vnc_connect(vs, csock, skipauth);
-+ return vnc_connect(vs, csock, skipauth, 0);
+- vnc_connect(vs, csock, skipauth);
++ vnc_connect(vs, csock, skipauth, 0);
}
---- xen-4.2.2.orig/tools/qemu-xen/ui/vnc.h
-+++ xen-4.2.2/tools/qemu-xen/ui/vnc.h
-@@ -101,6 +101,9 @@
+--- xen-4.3.0.orig/tools/qemu-xen/ui/vnc.h
++++ xen-4.3.0/tools/qemu-xen/ui/vnc.h
+@@ -99,6 +99,9 @@
#ifdef CONFIG_VNC_SASL
#include "vnc-auth-sasl.h"
#endif
@@ -866,7 +898,7 @@
struct VncRectStat
{
-@@ -128,6 +131,11 @@
+@@ -142,6 +145,11 @@
QEMUTimer *timer;
int timer_interval;
int lsock;
@@ -878,7 +910,7 @@
DisplayState *ds;
kbd_layout_t *kbd_layout;
int lock_key_sync;
-@@ -265,11 +273,19 @@
+@@ -269,11 +277,19 @@
#ifdef CONFIG_VNC_SASL
VncStateSASL sasl;
#endif
@@ -897,8 +929,8 @@
+#endif
/* current output mode information */
VncWritePixels *write_pixels;
- DisplaySurface clientds;
-@@ -489,6 +505,8 @@
+ PixelFormat client_pf;
+@@ -493,6 +509,8 @@
void vnc_write_u8(VncState *vs, uint8_t value);
void vnc_flush(VncState *vs);
void vnc_read_when(VncState *vs, VncReadEvent *func, size_t expecting);
@@ -907,16 +939,13 @@
/* Buffer I/O functions */
-@@ -507,10 +525,11 @@
- /* Buffer management */
- void buffer_reserve(Buffer *buffer, size_t len);
- int buffer_empty(Buffer *buffer);
--uint8_t *buffer_end(Buffer *buffer);
+@@ -510,7 +528,8 @@
void buffer_reset(Buffer *buffer);
void buffer_free(Buffer *buffer);
void buffer_append(Buffer *buffer, const void *data, size_t len);
+-
+void buffer_advance(Buffer *buf, size_t len);
+uint8_t *buffer_end(Buffer *buffer);
-
/* Misc helpers */
+