vnc: Add break statement
This was not a bug, but it is not common practice to omit the break statementfrom the last case statement before an empty default case.
Any change of the default case would introduce a bug.
This was reported as a warning by splint....
spice: use error_report to report errors
Error message reporting during spice startup wasn't consistent, it was donewith fprintf(stderr, "") but sometimes the message didn't have a trailing\n. Using error_report make the intent of the message clearer and deal...
Error out when tls-channel option is used without TLS
It's currently possible to setup spice channels using TLS whenno TLS port has been specified (ie TLS is disabled). This cannotwork, so better to error out in such a situation.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
qxl: introduce QXLCookie
Will be used in the next patch.
Signed-off-by: Alon Levy <alevy@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
qxl: make qxl_render_update async
RHBZ# 747011
Removes the last user of QXL_SYNC when using update drivers that use the_ASYNC io ports.
The last user is qxl_render_update, it is called both by qxl_hw_updatewhich is the vga_hw_update_ptr passed to graphic_console_init, and by...
qxl: fix spice+sdl no cursor regression
regression introduced by 075360945860ad9bdd491921954b383bf762b0e5,
v2: lock around qemu_spice_cursor_refresh_unlocked
Reported-by: Fabiano Fidêncio <fabiano@fidencio.org>Signed-off-by: Alon Levy <alevy@redhat.com>...
sdl: remove NULL check, g_malloc0 can't fail
qxl: require spice >= 0.8.2
drop all ifdefs on SPICE_INTERFACE_QXL_MINOR >= 1 as a result,any check for SPICE_SERVER_VERSION that is now always satisfied,and SPICE_INTERFACE_CORE_MINOR >= 3 tests, because0.8.2 has SPICE_INTERFACE_QXL_MINOR 1 andSPICE_INTERFACE_CORE_MINOR 3....
Revert "qemu-char: Print strerror message on failure" and deps
The commit's purpose is laudable:
The only way for chardev drivers to communicate an error was to return a NULL pointer, which resulted in an error message that said that something went wrong, but not why....
Add SPICE support to add_client monitor command
With the acceptance of some new APIs to libspice-server.so itis possible to add support for SPICE to the 'add_client'monitor command, bringing parity with VNC. Since SPICE canuse TLS or plain connections, the command also gains a new...
spice: support ipv6 channel address in monitor events and in spice info
RHBZ #788444
CC: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
vnc: Don't demote authentication scheme when changing password/disabling login
Currently when disabling login in VNC, the password is cleared out and theauthentication protocol is forced to AUTH_VNC. If you're using a strongerauthentication protocol, this has the effect of downgrading your security...
Merge remote-tracking branch 'kraxel/vnc.2' into staging
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types)Also, type_init() is a function, so add preceding blank line wherenecessary and don't put a semicolon after the closing brace....
Fix vnc memory corruption with width = 1400
vnc assumes that the screen width is a multiple of 16 in several places.If this is not the case vnc will overrun buffers, corrupt memory, makeqemu crash.
This is the minimum fix for this bug. It makes sure we don't overrun the...
vnc: fix ctrl key in vnc terminal emulation
Make the control keys for terminals on the vnc display(i.e. qemu -vnc :0 -serial vc) work. Makes the terminalsalot more usable as typing Ctrl-C in your serial consoleactually has the desired effect ;)
vnc: implement shared flag handling.
VNC clients send a shared flag in the client init message. Up to nowqemu completely ignores this. This patch implements shared flaghandling. It comes with three policies: By default qemu behaves as onewould expect: Asking for a exclusive access grants exclusive access to...
vnc: lift modifier keys on client disconnect.
For any modifier key (shift, ctrl, alt) still pressed on disconnectinject a key-up event into the guest. The vnc client is gone, it willnot do that, so qemu has to do it instead.
Without this keys will get stuck, making the guest act in weird ways...
sdl: Fix block prevention of SDL_WM_GrabInput
Consistently check for SDL_APPINPUTFOCUS before trying to grab the inputfocus. Just checking for SDL_APPACTIVE doesn't work. Moving the check tosdl_grab_start allows for some consolidation.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Revert "Handle SDL grabs failing (Mark McLoughlin)"
This reverts commit 6bb816031f8bc0aafc3476e6dfa4293ee3a5f106.
SDL_WM_GrabInput does not reliably bail out if grabbing is impossible.So if we get here, we already lost and will block. But this can nolonger happen due to the check in sdl_grab_start. So this patch became...
sdl: Grab input on end of non-absolute mouse click
By grabbing the input already on button down, we leave the button inthat state for the host GUI. Thus it takes another click after releasingthe input again to synchronize the mouse button state.
Avoid this by grabbing on button up....
sdl: Limit sdl_grab_end in handle_activation to Windows hosts
There are scenarios on Linux with some SDL versions wherehandle_activation is continuous invoked with state = SDL_APPINPUTFOCUSand gain = 0 while we grabbed the input. This causes a ping-pong when we...
sdl: Do not grab mouse on mode switch while in background
When the mouse mode changes to absolute while the SDL windows is not infocus, refrain from grabbing the input. It would steal from some otherwindow.
vnc: Simplify vnc_display_password()
Drop the qerror_report() call from it and let its callers set the errorthemselves. This also allows for dropping the 'ret' variable.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
vnc: fix no-lock-key-sync strncmp() length
The no-lock-key-sync option is being parsed incorrectly because of anoutdated strcmp() length value. Use the correct length so that invalidoption names do not match.
Reported-by: Dr David Alan Gilbert <davidagilbert@uk.ibm.com>...
Merge remote-tracking branch 'stefanha/trivial-patches-next' into staging
Fix spelling in comments, documentation and messages
accidently->accidentallyannother->anotherchoosen->chosenconsideres->considersdecriptor->descriptordevelopement->developmentparamter->parameterpreceed->precedepreceeding->precedingpriviledge->privilege...
qemu-thread: add API for joinable threads
Split from Jan's original qemu-thread-posix.c patch. No semantic change,just introduce the new API that POSIX and Win32 implementations willconform to.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
fix typo: delete redundant semicolon
Double semicolons should be single.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
fix spelling in ui sub directory
Cc: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
ui: Plug memory leaks on parse_keyboard_layout() error path
Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ui/vnc: Convert sasl.mechlist to g_malloc() & friends
Fixes protocol_client_auth_sasl_mechname() not to crash when malloc()fails. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Merge remote-tracking branch 'afaerber/cocoa-for-upstream' into staging
ui/vnc: Fix use of free() instead of g_free()
Please note that mechlist still uses malloc / strdup / free.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cocoa: Close sheet after image file selection
If no disk image is specified, the Cocoa frontend displays a modal sheetto let the user select an image file to boot from.
This sheet is never closed and it permanently obscures the emulator window.
Close it after obtaining the file name in case the user did select a file....
Merge remote-tracking branch 'qmp/queue/qmp' into staging
Conflicts: ui/spice-core.c
qapi: Convert query-vnc
There are three important remarks in relation to the non-qapi command:
1. This commit also fixes the behavior of the 'query-vnc' and 'info vnc' commands to return an error when qemu is built without VNC support (ie. --disable-vnc). The non-qapi command would return the OK...
qapi: Convert query-spice
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
ui/spice-core: fix segfault in monitor
Fix segfault if a qxl device is present but no spice command lineargument is given.
RHBZ 743251.
Signed-off-by: Alon Levy <alevy@redhat.com>
spice: fix file handle cleanup
Setting both read and write handlers to NULL in qemu_set_fd_handleris not enougth to make qemu purge the file handle from the list.We must set opaque to NULL too.
spice: turn client_migrate_info to async
RHBZ 737921Spice client is required to connect to the migration target before/as migrationstarts. Since after migration starts, the target qemu is blocked and cannot accept new spice clientwe trigger the connection to the target upon client_migrate_info command....
spice: support the new migration interface (spice 0.8.3)
- call spice_server_migrate_(start|end|connect).- register spice_migrate_connect completion callback
spice: Convert core to QEMU thread API
No need to use pthread directly, we have proper abstractions foridentity checking.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
migration: Export a function that tells if the migration has finished correctly
This will allow us to hide the state values.
Signed-off-by: Juan Quintela <quintela@redhat.com>
use qemu_* ctype functions
Fix "warning: array subscript has type 'char'" on NetBSD.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Drop unneeded pthread.h inclusions
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Replace the VMSTOP macros with a proper state type
Today, when notifying a VM state change with vm_state_notify(),we pass a VMSTOP macro as the 'reason' argument. This is not idealbecause the VMSTOP macros tell why qemu stopped and not exactlywhat the current VM state is....
Drop the vm_running global variable
Use runstate_is_running() instead, which is introduced by this commit.
vns/tls: don't use depricated gnutls functions
Avoid using deprecated gnutls functions with recent gnutls versions.Fixes build failure on Fedora 16. Keep the old way for compatibilitywith old installations such as RHEL-5 (gnutls 1.4.x).
Based on a patch from Raghavendra D Prabhu <raghu.prabhu13@gmail.com>...
spice: set qxl->ssd.running=true before telling spice to start, RHBZ #733993
If qxl->ssd.running=true is set after telling spice to start, the spice serverthread can call qxl_send_events while qxl->ssd.running is still false. This leads toassert(d->ssd.running)....
spice: workaround a spice server bug.
spice server might call the channel_event callback from spice serverthread context. Detect that and aquire iothread lock if needed,
sdl: Don't release input on mouse mode change in full-screen mode
While in full-screen mode, the input focus naturally belongs to the SDLwindow. Avoid dropping it when switching from absolute to relativemouse mode.
Convert last qemu_free and qemu_malloc uses
7267c0947d7e8ae5dff7bafd932c3bc285f43e5c misseda few cases, fix them.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ui/spice-core: report compiled-version in info spice/query-spice
sdl: Refactor sdl_send_mouse_event
Replace width/height globals with the identical values from real_screen,refactor the function according to our coding style.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
sdl: Fix full screen toggling from scaled mode
When switching to full screen mode from a scaled window, we need toresize to DisplayState's dimension, not the scaled "real" screen size.Moreover, scaling mode may have manipulated the bpp. So we need torestore it from the DisplayState as well....
sdl: Restore scaling mode on return from full screen
Save the scaling mode and its geometry when going full screen, restoreit when returning to windowed mode.
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
sdl: Drop bogus gui_fullscreen_initial_grab
There must be no difference between initial -full-screen and switchingto this mode via the hot key.
sdl: Initialize gui_fullscreen earlier during setup
This ensures that we actually enter full screen on startup when e.g.'-vga none -full-screen' was specified.
sdl: Consistently avoid grabbing input for text consoles
There were some preexisting bits that released the input when switchingto text console. This patch spreads this logic consistently and alsoavoids grabbing the input while a text console is active....
sdl: Never release input while in full screen mode
It's confusing to suddenly find two mice in full screen mode whenswitching consoles or accidentally hitting the grab hot keys.
sdl: Fix cursor handling when switching consoles in absolute mouse mode
Restore the cursor when switching from graphic to text console while themouse is in absolute mode. Disable it again when returning.
sdl: Dynamically grab input in absolute mouse mode
Not grabbing the input means that special keys like ALT+TAB are stillhandled by the host. Improve the usability by grabbing input once themouse is inside the guest screen, provided the SDL window has the input...
sdl: Add zoom hot keys
Allow to enlarge or shrink the screen via CTRL-ALT-+/-. In contrast toscaling the window, these controls always preserve the aspect ratio ofthe current console.
sdl: Factor out event handlers from sdl_refresh
No functional changes.
sdl: Fix termination in -no-shutdown mode
Just like the monitor does, we need to clear no_shutdown before callingqemu_system_shutdown_request on quit requests. Otherwise, QEMU juststops the VM.
sdl: Do not make full screen mode resizable
This prevents continuous resizing events and improper screen setups whengoing full screen.
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
sdl: Avoid redundant scaling deactivation
Prevents screen flickering.
sdl: Properly mark modifier+u as hotkey
qxl: async io support using new spice api
Some of the QXL port i/o commands are waiting for the spice server tocomplete certain actions. Add async versions for these commands, so wedon't block the vcpu while the spice server processses the command.Instead the qxl device will raise an IRQ when done....
spice: add worker wrapper functions.
Add wrapper functions for all spice worker calls.
spice: add qemu_spice_display_init_common
Factor out SimpleSpiceDisplay initialization intoqemu_spice_display_init_common() and call it fromboth qxl.c (for vga mode) and spice-display.c
spice/qxl: move worker wrappers
Move the wrapper functions which are used by qxl only to qxl.c.Rename them from qemu_spice_* to qxl_spice_*. Also pass in aqxl state pointer instead of a SimpleSpiceDisplay pointer.
Wrap recv to avoid warnings
Avoid warnings like these by wrapping recv(): CC slirp/ip_icmp.o/src/qemu/slirp/ip_icmp.c: In function 'icmp_receive':/src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror]...
notifier: Pass data argument to callback
This allows to pass additional information to the notifier callbackwhich is useful if sender and receiver do not share any other distinctdata structure.
Will be used first for the clock reset notifier.
Store VNC auth scheme per-client as well as per-server
A future patch will introduce a situation where differentclients may have different authentication schemes set.When a new client arrives, copy the 'auth' and 'subauth'fields from VncDisplay into the client's VncState, and...
Introduce a 'client_add' monitor command accepting an open FD
Allow client connections for VNC and socket based characterdevices to be passed in over the monitor using SCM_RIGHTS.
One intended usage scenario is to start QEMU with VNC on aUNIX domain socket. An unprivileged user which cannot access...
Remove unused USES_X509_AUTH macro from VNC sasl code
The USES_X509_AUTH macro is defined in several VNC files,but not used in all of them. Remove the unused definition.
qemu-char: Print strerror message on failure
The only way for chardev drivers to communicate an error was to return a NULLpointer, which resulted in an error message that said that something wentwrong, but not why.
This patch changes the interface to return 0/-errno and updates...
spice: add sanity check for spice ports
Make sure at least one port (port=.. or tls-port=...)is specified. Also apply range checks to the port numbers.
spice: catch spice server initialization failures.
When the spice server initialization fails report this and exit insteadof ignoring the error.
qxl: set mm_time in vga update
This fixes a problem where on windows 7 startup phase, before the qxl driveris loaded, the drawables are sufficiently large and video like to trigger astream, but the lack of a filled mm time field triggers a warning in spice-gtk....
vnc: Fix compilation with --enable-vnc-png
Commit f26e428da505709ec03b2ed2c9eb3db82b30bd7b fixed compilationwith --enable-vnc-png, but broke it with --enable-vnc-png.
The breakage is caused by pngconfig.h which checks whethersetjmp.h was already included and fails because qemu-common.h...
Fix MinGW compilation when --enable-vnc-jpeg is specified
Fix conflicting types for 'INT32' in basetsd.h and jmorecfg.h byincluding qemu-common.h first.
Signed-off-by: Roy Tam <roytam@gmail.com>Acked-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cocoa: Provide central qemu_main() prototype
This fixes a missing prototype warning in vl.c and obsoletesthe prototype in cocoa.m. Adjust callers in cocoa.m to supplythird argument, which is currently only used on Linux/ppc.
The prototype is designed so that it could be shared with SDL...
cocoa: Avoid warning related to multiple handleEvent: definitions
Avoid compiler confusion as to which method signature to use for thehandleEvent: selector on OSX >= 10.6 by making the variable type-safeas opposed to generic 'id' type.Requires moving the variable definition to after the class definition....
Cocoa: avoid displaying window when command-line contains '-h' or '-help'
There was already a check in place to avoid displaying a windowin certain modes such as vnc, nographic or curses.
Add a check for '-h' and '-help' to avoid displaying a window for a split-...
cocoa: do not create a spurious window for -version
When invoked with -version, qemu will exit just after displaying the version,so there is no need to create a window.Also handles --XXX options.
Signed-off-by: Tristan Gingold <gingold@adacore.com>Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Merge remote-tracking branch 'spice/spice.v37' into staging
Conflicts: vl.c
Fix compilation warning due to missing header for sigaction (followup)
This patch removes all references to signal.h when qemu-common.h is includedas they become redundant.
Signed-off-by: Alexandre Raymond <cerbere@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
spice: add option for disabling copy paste support
Some people want to be able disable spice's guest <-> client copy paste supportbecause of security considerations.
[ kraxel: drop old-version error message ]
spice: add SASL support
Turn on SASL support by appending "sasl" to the spice arguments, whichrequires that the client use SASL to authenticate with the spice. Theexact choice of authentication method used is controlled from thesystem / user's SASL configuration file for the 'qemu' service. This...
spice: require spice 0.6.0 or newer.
This patch raises the minimum required spice version to 0.6.0 and dropsa few ifdefs.
0.6.0 is the first stable release with the current libspice-server API,there shouldn't be any 0.5.x development versions deployed any more....
set $SDL_VIDEODRIVER=x11 on Linux to prevent sudo kvm from fighting for video card
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>Acked-by: Alexander Graf <agraf@suse.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Make spice dummy functions inline to fix calls not checking return values
qemu_spice_set_passwd() and qemu_spice_set_pw_expire() dummy functionsneeds to be inline, in order to handle the case where they are calledwithout checking the return value.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>...
spice: don't create updates in spice server context.
This patch moves the creation of spice screen updates from the spiceserver context to qemu iothread context (display refresh timer to beexact). This way we avoid accessing qemu internals (display surface)...
spice: don't call displaystate callbacks from spice server context.
This patch moves the displaystate callback calls for setting the cursorand the mouse pointer from spice server to qemu (iothread) context.This allows us to simplify locking.
spice: drop obsolete iothread locking
We don't use qemu internals from spice server context any more.Thus we don't also need to grab the iothread mutex from spiceserver context. And we don't have to temporarely release thelock to avoid deadlocks. Drop all the calls....
vnc: tight: Fix crash after 2GB of output
fix 2Gb integer overflow in in VNC tight and zlib encodings
As found by Roland Dreier <roland@purestorage.com> (excellentcatch!), when amount of VNC compressed data produced by zliband sent to client exceeds 2Gb, integer overflow occurs because...