summaryrefslogtreecommitdiffstats
path: root/ui/vnc.c
Commit message (Collapse)AuthorAgeFilesLines
* TLS support for VNC WebsocketsTim Hardeck2013-05-031-19/+67
| | | | | | | | | | | | | | | | | | | | | | | Added TLS support to the VNC QEMU Websockets implementation. VNC-TLS needs to be enabled for this feature to be used. The required certificates are specified as in case of VNC-TLS with the VNC parameter "x509=<path>". If the server certificate isn't signed by a rooth authority it needs to be manually imported in the browser because at least in case of Firefox and Chrome there is no user dialog, the connection just gets canceled. As a side note VEncrypt over Websocket doesn't work atm because TLS can't be stacked in the current implementation. (It also didn't work before) Nevertheless to my knowledge there is no HTML 5 VNC client which supports it and the Websocket connection can be encrypted with regular TLS now so it should be fine for most use cases. Signed-off-by: Tim Hardeck <thardeck@suse.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366727581-5772-1-git-send-email-thardeck@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: Adjust lock state sync logic with VNC_FEATURE_LED_STATELei Li2013-04-291-0/+5
| | | | | | | Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366867752-11578-4-git-send-email-lilei@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: Support for LED state extensionLei Li2013-04-291-0/+45
| | | | | | | Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366867752-11578-3-git-send-email-lilei@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: Add SCROLL lock key to kbd_ledsLei Li2013-04-291-1/+5
| | | | | | | Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366867752-11578-2-git-send-email-lilei@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* console: zap ds arg from register_displaychangelistenerGerd Hoffmann2013-04-251-1/+1
| | | | | | | We don't have multiple DisplayStates any more, so passing it in as argument is not needed. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: add qemu_console_is_*Gerd Hoffmann2013-04-161-3/+3
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: gui timer fixesGerd Hoffmann2013-04-161-51/+20
| | | | | | | | | Make gui update rate adaption code in gui_update() actually work. Sprinkle in a tracepoint so you can see the code at work. Remove the update rate adaption code in vnc and make vnc simply use the generic bits instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: rename vga_hw_*, add QemuConsole paramGerd Hoffmann2013-04-161-6/+6
| | | | | | | | | | | | Add QemuConsole parameter to vga_hw_*, so the interface allows to update non-active consoles (the actual code can't handle this yet, see next patch). Passing NULL is allowed and updates the active console, like the functions do today. While touching all vga_hw_* calls anyway rename that to the functions to hardware-neutral graphics_hw_* Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()Stefan Hajnoczi2013-04-021-1/+1
| | | | | | | | | The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets. Rename to qemu_set_nonblock() just like qemu_set_cloexec(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* console: zap displaystate from dcl callbacksGerd Hoffmann2013-03-181-5/+0
| | | | | | | Now that nobody depends on DisplayState in DisplayChangeListener callbacks any more we can remove the parameter from all callbacks. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vnc: stop using DisplayStateGerd Hoffmann2013-03-181-34/+43
| | | | | | | Rework DisplayStateListener callbacks to not use the DisplayState any more. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: rework DisplaySurface handling [dcl/ui side]Gerd Hoffmann2013-03-181-16/+5
| | | | | | | | Replace the dpy_gfx_resize and dpy_gfx_setdata DisplayChangeListener callbacks with a dpy_gfx_switch callback which notifies the ui code when the framebuffer backing storage changes. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: kill DisplayState->opaqueGerd Hoffmann2013-03-181-21/+17
| | | | | | | | | | | | It's broken by design. There can be multiple DisplayChangeListener instances, so they simply can't store state in the (single) DisplayState struct. Try 'qemu -display gtk -vnc :0', watch it crash & burn. With DisplayChangeListenerOps having a more sane interface now we can simply use the DisplayChangeListener pointer to get access to our private data instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: fix displaychangelisteners interfaceGerd Hoffmann2013-03-181-14/+30
| | | | | | | | Split callbacks into separate Ops struct. Pass DisplayChangeListener pointer as first argument to all callbacks. Uninline a bunch of display functions and move them from console.h to console.c Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vnc: fix possible uninitialized removalsTim Hardeck2013-01-211-3/+8
| | | | | | | | | Some VncState values are not initialized before the Websocket handshake. If it fails QEMU segfaults during the cleanup. To prevent this behavior intialization checks are added. Signed-off-by: Tim Hardeck <thardeck@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: added initial websocket protocol supportTim Hardeck2013-01-211-18/+169
| | | | | | | | | | | | | | | | | | | | | This patch adds basic Websocket Protocol version 13 - RFC 6455 - support to QEMU VNC. Binary encoding support on the client side is mandatory. Because of the GnuTLS requirement the Websockets implementation is optional (--enable-vnc-ws). To activate Websocket support the VNC option "websocket"is used, for example "-vnc :0,websocket". The listen port for Websocket connections is (5700 + display) so if QEMU VNC is started with :0 the Websocket port would be 5700. As an alternative the Websocket port could be manually specified by using ",websocket=<port>" instead. Parts of the implementation base on Anthony Liguori's QEMU Websocket patch from 2010 and on Joel Martin's LibVNC Websocket implementation. Signed-off-by: Tim Hardeck <thardeck@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: added buffer_advance functionTim Hardeck2013-01-211-4/+9
| | | | | | | | | | Following Anthony Liguori's Websocket implementation I have added the buffer_advance function to VNC and replaced all related buffer memmove operations with it. Signed-off-by: Tim Hardeck <thardeck@suse.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* misc: move include files to include/qemu/Paolo Bonzini2012-12-191-4/+4
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qapi: move include files to include/qobject/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* pixman: fix vnc tight png/jpeg supportGerd Hoffmann2012-12-141-1/+1
| | | | | | | | | | | | | This patch adds an x argument to qemu_pixman_linebuf_fill so it can also be used to convert a partial scanline. Then fix tight + png/jpeg encoding by passing in the x+y offset, so the data is read from the correct screen location instead of the upper left corner. Cc: 1087974@bugs.launchpad.net Cc: qemu-stable@nongnu.org Reported-by: Tim Hardeneck <thardeck@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* vnc: fix option misspelling ("non-adapative" -> "non-adaptive")Catalin Patulea2012-11-261-1/+1
| | | | | Signed-off-by: Catalin Patulea <catalinp@google.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge branch 'trivial-patches' of git://github.com/stefanha/qemuBlue Swirl2012-11-031-7/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'trivial-patches' of git://github.com/stefanha/qemu: pc: Drop redundant test for ROM memory region exec: make some functions static target-ppc: make some functions static ppc: add missing static vnc: add missing static vl.c: add missing static target-sparc: make do_unaligned_access static m68k: Return semihosting errno values correctly cadence_uart: More debug information Conflicts: target-m68k/m68k-semi.c
| * vnc: add missing staticBlue Swirl2012-11-011-7/+7
| | | | | | | | | | | | | | Add missing 'static' qualifiers. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* | pixman/vnc: remove dead code.Gerd Hoffmann2012-11-011-18/+0
| | | | | | | | | | | | | | | | Switching the vnc server framebuffer to use 32bpp unconditionally turns the code bits which handle 8 and 16 bpp into dead code. Remove them. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | pixman/vnc: use pixman images in vnc.Gerd Hoffmann2012-11-011-103/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vnc code uses *three* DisplaySurfaces: First is the surface of the actual QemuConsole, usually the guest screen, but could also be a text console (monitor/serial reachable via Ctrl-Alt-<nr> keys). This is left as-is. Second is the current server's view of the screen content. The vnc code uses this to figure which parts of the guest screen did _really_ change to reduce the amount of updates sent to the vnc clients. It is also used as data source when sending out the updates to the clients. This surface gets replaced by a pixman image. The format changes too, instead of using the guest screen format we'll use fixed 32bit rgb framebuffer and convert the pixels on the fly when comparing and updating the server framebuffer. Third surface carries the format expected by the vnc client. That isn't used to store image data. This surface is switched to PixelFormat and a boolean for bigendian byte order. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | console: untangle gfx & txt updatesGerd Hoffmann2012-11-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stop abusing displaysurface fields for text mode displays. (bpp = 0, width = cols, height = lines). Add flags to displaystate indicating whenever text mode display (curses) or gfx mode displays (sdl, vnc, ...) are present. Add separate displaychangelistener callbacks for text / gfx mode resize & updates. This allows to enable gfx and txt diplays at the same time and also paves the way for more cleanups in the future. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | console: move set_mouse + cursor_define callbacksGerd Hoffmann2012-11-011-4/+4
|/ | | | | | | When adding DisplayChangeListeners the set_mouse and cursor_define callbacks have been left in DisplayState for some reason. Fix it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vnc: drop QERR_VNC_SERVER_FAILEDPaolo Bonzini2012-10-231-3/+0
| | | | | | | We now always return "nice" error messages in errp when we goto fail. Drop the default error message. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* vnc: add error propagation to vnc_display_openPaolo Bonzini2012-10-231-19/+23
| | | | | | | | | | | | | | | | | | | | | | Before: $ qemu-system-x86_64 -vnc foo.bar:12345 getaddrinfo(foo.bar,18245): Name or service not known Failed to start VNC server on `foo.bar:12345' $ qemu-system-x86_64 -vnc localhost:12345,reverse=on inet_connect_opts: connect(ipv4,yakj.usersys.redhat.com,127.0.0.1,12345): Connection refused Failed to start VNC server on `localhost:12345,reverse=on' After: $ x86_64-softmmu/qemu-system-x86_64 -vnc foo.bar:12345 Failed to start VNC server on `foo.bar:12345': address resolution failed for foo.bar:18245: Name or service not known $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:12345,reverse=on Failed to start VNC server on `localhost:12345,reverse=on': Failed to connect to socket: Connection refused Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* vnc: reorganize code for reverse modePaolo Bonzini2012-10-231-11/+9
| | | | | | Avoid the dance between csock and vs->lsock. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* vnc: introduce a single label for error returnsPaolo Bonzini2012-10-231-25/+17
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* vnc: avoid Yoda conditionalsPaolo Bonzini2012-10-231-2/+2
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu-sockets: add Error ** to all functionsPaolo Bonzini2012-10-231-2/+2
| | | | | | | | This lets me adjust the clients to do proper error propagation first, thus avoiding temporary regressions in the quality of the error messages. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* ui/vnc: Only report/use TIGHT_PNG encoding if enabled.Joel Martin2012-10-191-0/+2
| | | | | | | | | | | | | If TIGHT_PNG is not enabled by the --enable-vnc-png configure flag then do not report to the client that it is supported. Also, since TIGHT_PNG is the same as the TIGHT encoding but with the filter/copy replaced with PNG data, adding it to the supported encodings list when it is disabled will cause the TIGHT encoding to be used even though the client requested TIGHT_PNG. Signed-off-by: Joel Martin <github@martintribe.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* vnc: fix "info vnc" with "-vnc ..., reverse=on"Paolo Bonzini2012-10-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | When reverse connection is in use, there is no active VNC server socket. Because of this, getsockopt(-1, ...) is attempted and the following error is emitted: $ socat TCP-LISTEN:5900,reuseaddr TCP-LISTEN:5901,reuseaddr & $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc An undefined error has occurred Because however the host, family, service and auth fields are optional, we can just exit if there is no active server socket. $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc Server: Client: address: 127.0.0.1:5900 x509_dname: none username: none Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Separate inet_connect into inet_connect (blocking) and inet_nonblocking_connectOrit Wasserman2012-09-251-1/+1
| | | | | | | | No need to add non blocking parameters to the blocking inet_connect add block parameter for inet_connect_opts instead of using QemuOpt "block". Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: inet_connect(), inet_connect_opts(): add in_progress argumentLuiz Capitulino2012-08-131-1/+1
| | | | | | | | | | | | It's used to indicate the special case where a valid file-descriptor is returned (ie. success) but the connection can't be completed w/o blocking. This is needed because QERR_SOCKET_CONNECT_IN_PROGRESS is not treated like an error and a future commit will drop it. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* vnc: disable VNC password authentication (security type 2) when in FIPS modePaul Moore2012-08-031-0/+10
| | | | | | | | | | | | | | | | FIPS 140-2 requires disabling certain ciphers, including DES, which is used by VNC to obscure passwords when they are sent over the network. The solution for FIPS users is to disable the use of VNC password auth when the host system is operating in FIPS compliance mode and the user has specified '-enable-fips' on the QEMU command line. This patch causes QEMU to emit a message to stderr when the host system is running in FIPS mode and a VNC password was specified on the commend line. If the system is not running in FIPS mode, or is running in FIPS mode but VNC password authentication was not requested, QEMU operates normally. Signed-off-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Avoid returning voidBlue Swirl2012-07-281-1/+1
| | | | | | | It's silly and non-conforming to standards to return void, don't do it. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Remove support for non-threaded VNC serverDaniel P. Berrange2012-06-271-21/+0
| | | | | | | | | | QEMU now has a fundamental requirement for pthreads, so there is no compelling reason to retain support for the non-threaded VNC server. Remove the --{enable,disable}-vnc-thread configure arguments, and all CONFIG_VNC_THREAD conditionals Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: fix segfault in vnc_display_pw_expire()Gerd Hoffmann2012-05-301-0/+4
| | | | | | | | NULL pointer dereference in case no vnc server is configured. Catch this and return -EINVAL like vnc_display_password() does. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sockets: use error class to pass listen errorAmos Kong2012-05-101-1/+2
| | | | | | | | | | | | Add a new argument in inet_listen()/inet_listen_opts() to pass back listen error. Change nbd, qemu-char, vnc to use new interface. Signed-off-by: Amos Kong <akong@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sockets: change inet_connect() to support nonblock socketAmos Kong2012-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | Add a bool argument to inet_connect() to assign if set socket to block/nonblock, and delete original argument 'socktype' that is unused. Add a new argument to inet_connect()/inet_connect_opts(), to pass back connect error by error class. Retry to connect when -EINTR is got. Connect's successful for nonblock socket when following errors are got, user should wait for connecting by select(): -EINPROGRESS -EWOULDBLOCK (win32) -WSAEALREADY (win32) Change nbd, vnc to use new interface. Signed-off-by: Amos Kong <akong@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: Limit r/w access to size of allocated memoryStefan Weil2012-03-141-0/+3
| | | | | | | | | This fixes memory reads and writes which exceeded the upper limit of allocated memory vd->guest.ds->data and vd->server->data. Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: don't mess up with iohandlers in the vnc threadCorentin Chary2012-03-141-0/+12
| | | | | | | | | | | | | | | | | | The threaded VNC servers messed up with QEMU fd handlers without any kind of locking, and that can cause some nasty race conditions. Using qemu_mutex_lock_iothread() won't work because vnc_dpy_cpy(), which will wait for the current job queue to finish, can be called with the iothread lock held. Instead, we now store the data in a temporary buffer, and use a bottom half to notify the main thread that new data is available. vnc_[un]lock_ouput() is still needed to access VncState members like abort, csock or jobs_buffer. Signed-off-by: Corentin Chary <corentin.chary@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* implement vnc_dpy_setdataGerd Hoffmann2012-03-121-1/+4
| | | | | | | | | | | | The comment is wrong, we have to do something in the setdata callback. Changing the framebuffer backing storage (happens when the guest pans the display) renders the whole screen content invalid. Trigger #1: cirrus vga + 32bit linux guest + vesafb with ypan enabled. Trigger #2: std vga + http://patchwork.ozlabs.org/patch/145479/ Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vnc: Don't demote authentication scheme when changing password/disabling loginDaniel P. Berrange2012-02-171-2/+6
| | | | | | | | | | | | | | | | | | | | | | | Currently when disabling login in VNC, the password is cleared out and the authentication protocol is forced to AUTH_VNC. If you're using a stronger authentication protocol, this has the effect of downgrading your security protocol. Fix this by only changing the authentication protocol if the current authentication protocol is AUTH_NONE. That ensures we're never downgrading. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> -- NB. This patch is derived from one posted by Anthony last year, which got accidentally lost after Luiz took over the QMP series work https://lists.gnu.org/archive/html/qemu-devel/2011-09/msg00392.html v1 -> v2 - Make sure to not demote when changing password (Daniel) v2 -> v3 - Rebase to latest GIT master wrt QMP changes
* vnc: lift modifier keys on client disconnect.Gerd Hoffmann2012-02-101-0/+25
| | | | | | | | | | | | | For any modifier key (shift, ctrl, alt) still pressed on disconnect inject a key-up event into the guest. The vnc client is gone, it will not do that, so qemu has to do it instead. Without this keys will get stuck, making the guest act in weird ways after reconnecting. Reproducer: exit vnc client via Alt-F4, guest continues to see the pressed alt key and will not react to key events in any useful way until you tap the alt key once to unstuck it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vnc: implement shared flag handling.Gerd Hoffmann2012-02-101-0/+98
| | | | | | | | | | | | | VNC clients send a shared flag in the client init message. Up to now qemu completely ignores this. This patch implements shared flag handling. It comes with three policies: By default qemu behaves as one would expect: Asking for a exclusive access grants exclusive access to the client connecting. There is also a desktop sharing mode which disallows exclusive connects (so one forgetting -shared wouldn't drop everybody else) and a compatibility mode which mimics the traditional (but non-conforming) qemu behavior. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
OpenPOWER on IntegriCloud