Commit Graph

4018 Commits

Author SHA1 Message Date
Frediano Ziglio
59f0efb5de red-stream-device: Constify stream_device_get_device_display_info result
There should be no reason for the caller to modify the internal
structure.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-02-04 19:44:12 +00:00
Eduardo Lima (Etrunko)
dcc8e1d565 meson: Use underscorify() instead of split()
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2019-02-01 13:07:30 -02:00
Eduardo Lima (Etrunko)
1b7c19bc1b m4: Remove repeated warnings suppression
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-02-01 08:48:08 +00:00
Frediano Ziglio
9bf95486e5 event-loop: Port to Windows
Use g_io_channel_win32_new_socket instead of g_io_channel_unix_new

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-01-31 11:06:37 +00:00
Frediano Ziglio
ec71c795f3 replay: Port to Windows
Client process termination did not work for Windows, used Win32
APIs.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-01-31 11:03:19 +00:00
Frediano Ziglio
aed85f0ff1 test-listen: Exclude Unix sockets part under Windows
Windows does not support Unix sockets.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-01-31 10:59:39 +00:00
Frediano Ziglio
b69fe6cb33 reds: Explicitly include inttypes.h
MingW does not include this header while including stdint.h so
on Windows you need to include it.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-01-31 10:49:54 +00:00
Frediano Ziglio
f8e8ac4910 windows: Do not include headers not available on Windows
This is a preparatory patch for next portability patches

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-01-31 10:48:34 +00:00
Frediano Ziglio
e91c57e6f4 red-qxl: Use proper formatting string for size_t
Avoids issues with LLP64 systems.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-01-31 10:35:02 +00:00
Frediano Ziglio
b4825e4b6b display-channel: Remove unused includes
display-channel.h is not using any of the definition from
these headers.
Adding a missing include to red-worker.c.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-01-30 15:44:47 +00:00
Frediano Ziglio
70a724be6e red-stream-device: Fix "make syntax-check"
Avoid using strncpy, considered not secure.
In this case a simple memcpy is used, we are going to terminate
the string in any case on the next line.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2019-01-30 15:18:59 +00:00
Frediano Ziglio
3a58f08ca4 image-encoders: Initialize Zlib lazily
Zlib structure take up more than 1MB and it is rarely used nowadays
as it is not much effective.
Initialise it only when necessary saving some memory in the normal
case.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-01-30 13:07:32 +00:00
Uri Lublin
889e6273bf smartcard: do not keep weak ref when device is NULL
When a client disconnects, smartcard_channel_client_set_char_device
is called with a NULL "device" argument. In that case there is
no need to take a weak reference to the device.

Without this patch the server complains:
  g_object_add_weak_pointer: assertion 'G_IS_OBJECT (object)' failed

and aborts when a second client attempts to connect.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-01-30 09:27:52 +00:00
Lukáš Hrázký
c8e949cea1 Send the graphics device info from streaming agent to the vd_agent
Adds the graphics device info from the streaming device(s) to the
VDAgentGraphicsDeviceInfo message sent to the vd_agent.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-01-29 15:47:00 +01:00
Lukáš Hrázký
e032e93411 Receive the GraphicsDeviceInfo message from the streaming agent
Receives the GraphicsDeviceInfo message from the streaming agent and
stores the data in a list on the streaming device.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-01-29 15:46:54 +01:00
Lukáš Hrázký
852ae0255c Send the graphics device info to the vd_agent
Sends the device address and device display IDs to the vdagent. The
message is sent either in reaction to the SPICE_MSGC_MAIN_AGENT_START
message or when the graphics device info changes.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-01-29 15:46:28 +01:00
Lukáš Hrázký
eceab252be QXL interface: improve the spice_qxl_set_device_info documentation
Instead of one unsupported example, present two real world examples.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-01-28 19:35:53 +00:00
Lukáš Hrázký
e3a2f9bb01 QXL interface: deprecate spice_qxl_set_max_monitors
Replace it by spice_qxl_set_device_info. Note we can't use
monitors_count for what's stored in max_monitors, because monitors_count
denotes the length of the device_display_ids array, which
spice_qxl_set_max_monitors doesn't touch.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-01-26 09:40:10 +00:00
Lukáš Hrázký
3de5f9ff48 QXL interface: add a function to identify monitors in the guest
Adds a function to let QEMU provide information to identify graphics
devices and their monitors in the guest. The function
(spice_qxl_set_device_info) sets the device address (e.g. a PCI path)
and monitor ID -> device display ID mapping of displays exposed by given
QXL interface.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-01-26 09:40:10 +00:00
Frediano Ziglio
08659f91b4 red-worker: Remove obsolete type definition
AsyncCommand was removed in eb6c8ba025.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-01-23 21:22:37 +00:00
Frediano Ziglio
3dfce50169 ci: Remove dependencies from copr build
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2019-01-23 19:15:44 +00:00
Frediano Ziglio
e5bc6f952c Trace streaming device data using recorder
Trace when data is received from the guest and when is sent
to the client.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-01-23 14:51:01 +00:00
Frediano Ziglio
1de0e6a292 Allows to enable recorder integration
recorder library will be used to collect some statistics during
development.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-01-23 14:51:00 +00:00
Frediano Ziglio
b9cc232a70 Update spice-common submodule
This brings in the following changes:

Frediano Ziglio (11):
      Update --enable-celt051 help string
      test-marshaller: Make test_overflow static
      test-marshaller: Make main declaration easier
      test-region: Add missing dependencies
      ci: Run tests on Windows using wine
      Use a single copy of subject string
      log: Use proper format attribute for spice_log
      marshaller: Provide spice_marshaller_fill_iovec for Windows
      test: Add a test for subject_to_x509_name function
      lz: Avoid buffer reading overflow checking for image type
      lz: More checks on image sizes

Jonathon Jongsma (1):
      Fix some additional typos

Marc-André Lureau (5):
      Bump libcacard requirement to 2.5.1
      Add a .gitpublish
      build-sys: improve asciidoc rules to allow multiple targets
      quic: fix sign-compare warning
      meson: fix building for big-endian host

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-01-23 14:50:47 +00:00
Frediano Ziglio
c67876757f Reuse SPICE_UPCAST instead of SPICE_CONTAINEROF where possible
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2019-01-17 16:34:23 +00:00
Christophe Fergeau
9b04c9961e sasl: Simplify red_stream_write_u32_le call with '0' serveroutlen
Instead of
if (serveroutlen) {
...
} else {
    red_stream_write_u32_le(stream, serveroutlen);
}

use 'red_stream_write_u32_le(stream, 0);' in the else block as it's
slightly more obvious.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-01-15 17:07:44 +01:00
Frediano Ziglio
6a463dc129 red-replay-qxl: Use PRIxPTR constant for string formatting
These constants are meant to be used in format string for pointers
types. Use them for portability.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-01-08 12:48:53 +00:00
Frediano Ziglio
c55058563f test-display-base: Remove error from "make syntax-check"
Due to previous commit "make syntax-check" command reports:

prohibit_signal_without_use
server/tests/test-display-base.c
maint.mk: the above files include signal.h but don't use it
make: *** [maint.mk:639: sc_prohibit_signal_without_use] Error 1

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-01-03 15:10:19 +00:00
Frediano Ziglio
5cbdf1a235 test-display-base: Port to Windows
Use GLib function to launch and wait process exit.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-01-03 13:08:17 +00:00
Frediano Ziglio
f5103aed1f replay: Force binary mode on input on Windows
If input contains the binary record we can't have it modified
during read.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-01-03 13:07:02 +00:00
Frediano Ziglio
27fc91986d test-playback: Simplify wave generation formulae
Split level computation, make clear is a sine wave on both channels.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2018-12-25 10:14:12 +00:00
Frediano Ziglio
cc9ddd6c1d test-playback: Remove obsolete debug
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2018-12-25 10:14:10 +00:00
Frediano Ziglio
f76d0bffed test-playback: Update misleading comments
We are waiting for a client connection, channel is already there

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2018-12-25 10:14:08 +00:00
Frediano Ziglio
10b93025f2 test-playback: Remove useless check for "frame"
We just fill it up, can't be NULL.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2018-12-25 10:14:05 +00:00
Frediano Ziglio
f7859820a1 reds_stat: Use EXIT_SUCCESS/EXIT_FAILURE for program result
-1 is not much portable and standard.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2018-12-23 17:04:01 +00:00
Frediano Ziglio
caefeececd reds_stat: Print errors on standard error, not standard output
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2018-12-23 17:03:36 +00:00
Frediano Ziglio
ecb6f224cf tests/pki: Use CA/certificate valid until 2048 and with 2048 bits
This changes tests/pki/server-cert.pem and tests/pki/ca-cert.pem to have
2048 bits. These certificates were generated using the
instructions on https://www.spice-space.org/spice-user-manual.html
The -subj args were omitted, and the defaults suggested by openssl used.
The -days parameter was changed to -days 10950, the bits to 2048.

This fixes https://gitlab.freedesktop.org/spice/spice/issues/27.

Some distros are starting to use stricter settings for their openssl
configuration, which forbids 1024 bit keys, and causes test suite
failures.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-12-07 12:31:11 +00:00
Christophe Fergeau
1c32e68072 qxl: Release QXL resources in red_put_surface_cmd
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:04:03 +00:00
Christophe Fergeau
473656d58e display-channel: Store full RedSurfaceCmd, not just QXLReleaseInfoExt
Now that we have a refcounted RedSurfaceCmd, we can store the command
itself in DisplayChannel rather than copying QXLReleaseInfoExt. This
will let us move the release of the QXL guest resources in red-parse-qxl
in the next commit.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:04:00 +00:00
Christophe Fergeau
8669c933ff qxl: Add red_surface_cmd_{new, ref, unref} helpers
Currently, RedWorker is using stack-allocated variables for RedSurfaceCmd.
Surface commands are rare enough that we can dynamically allocate them
instead, and make the API in red-parse-qxl.h consistent with how other
QXL commands are handled.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:58 +00:00
Christophe Fergeau
decfe65d73 qxl: Add red_update_cmd_{new, ref, unref} helpers
Currently, RedUpdateCmd are allocated on the stack, and then
initialized/uninitialized with red_{get,put}_update_cmd
This makes the API inconsistent with what is being done for RedDrawable,
RedCursor and RedMessage. QXLUpdateCmd are not occurring very often,
we can dynamically allocate them instead, and get a consistent API.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:55 +00:00
Christophe Fergeau
74663be7fc qxl: Release QXL resources in red_put_update_cmd
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:52 +00:00
Christophe Fergeau
5840ba2a89 qxl: Add red_message_{new, ref, unref} helpers
Currently, RedMessage are allocated on the stack, and then
initialized/uninitialized with red_{get,put}_message
This makes the API inconsistent with what is being done for RedDrawable
and RedCursor. Since QXLMessage is just a (mostly unused/unsecure) debugging tool,
we can dynamically allocate it instead, and get a consistent API.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:49 +00:00
Christophe Fergeau
60c425011c qxl: Release QXL resource in red_put_message
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:43 +00:00
Christophe Fergeau
fb3c602d75 qxl: Add red_cursor_cmd_{new, ref, unref} helpers
Currently, the cursor channel is allocating RedCursorCmd instances itself, and then
calling into red-parse-qxl.h to initialize it, and doing something
similar when releasing the data. This commit moves this common code to
red-parse-qxl.[ch]
The ref/unref are not strictly needed, red_cursor_cmd_free() would
currently be enough, but this makes the API consistent with
red_drawable_{new,ref,unref}.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:36 +00:00
Christophe Fergeau
f928763db6 qxl: Fix guest resources release in red_put_drawable()
At the moment, we'll unconditionally release the guest QXL resources in
red_put_drawable() even if red_get_drawable() failed and did not
initialize drawable->release_info_ext properly.
This commit only sets RedDrawable::qxl once the guest resource have been
successfully retrieved, and only free the guest QXL resources when
RedDrawable::qxl is set.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:33 +00:00
Christophe Fergeau
179134a4e8 qxl: Make red_{get, put}_drawable static
Rather than needing to call red_drawable_new() and then initialize it
with red_get_drawable(), we can improve slightly red_drawable new so
that red_drawable_{new,ref,unref} is all which is used by code out of
red-parse-qxl.c.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:31 +00:00
Christophe Fergeau
7f8228b540 qxl: Move red_drawable_unref/red_drawable_new
RedDrawable really is a RedDrawCmd which is parsed by red-parse-qxl.h
Moreover, red_drawable_ref() is already defined inline in
red-parse-qxl.h, and red_drawable_unref() is declared there too even if
its code is still in red-worker.c
This commit moves them close to the other functions creating/unref'ing
QXL commands parsed by red-parse-qxl.h.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-06 13:03:20 +00:00
Frediano Ziglio
70f56ad2fa tests: Use g_assert_(non)null instead of g_assert
Just a style change, on more recent GLib would print a more
friendly error report.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-12-04 09:03:27 +00:00
Marc-André Lureau
69a5cfc741 smartcard: set char device state
Follow all other char devices implementation (spicevmc, agent,
stream-device) and set the char device state when
connected/disconnected. This allows qemu to discard writes, optimize a
bit the source polling, and will trigger HUP events.

See related qemu "char/spice: discard write() if backend is
disconnected".

Note: sif->state() should probably be handled at the char-device
level. I am not sure what the smartcard channel really brings over
plain spicevmc...

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-12-03 17:02:09 +00:00