Commit Graph

4296 Commits

Author SHA1 Message Date
Frediano Ziglio
3b9d1eadf7 red-channel-client: Fix indentation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-12-04 12:15:56 +00:00
Frediano Ziglio
ac41e6097a red-channel-client: Reuse "monitor" variable
"&rcc->priv->connectivity_monitor" is cached in "monitor" variable.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-12-04 12:15:56 +00:00
Frediano Ziglio
0fc5af3a06 Do not check for NULL calling red_watch_remove and red_timer_remove
These functions already check for NULL.
They are used mainly for cleanup, so cold path of code so speed
in case of NULL is not important (and usually should not be NULL).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-12-04 12:15:56 +00:00
Frediano Ziglio
250d4480ff red-channel-client: Reduce indentation in red_channel_client_handle_outgoing
When write fails, all cases of the switch are handled.
Make this clear.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-04 12:15:56 +00:00
Snir Sheriber
827cdae4de ci: trigger spice-space ci with every docs change
Trigger spice-space build if docs/ has changed and TOKEN is set
This is not defined as deploy stage so it won't be depended on the other jobs

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-27 12:21:11 +00:00
Frediano Ziglio
13de28fc27 Update spice-common submodule
This brings in the following changes:

Fabrice Fontaine (2):
      configure.ac: add --enable-tests
      meson: add tests option

Frediano Ziglio (4):
      codegen: Add 'chunk' to the output attributes
      codegen: Check validity of array members
      codegen: Document "chunk" attribute
      codegen: Ignore path generating include guards

Kevin Pouget (3):
      agent-interface: introduce the core of the Agent Interface
      agent-interface: add configuration functions
      build: Introduce the agent-interface as an alternative instrumentation library

Updated files are due to agent-interface updates.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2019-11-26 15:39:07 +00:00
Frediano Ziglio
7f501b0df1 ci: Fix a typo in comment
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-11-26 09:22:14 +00:00
Frediano Ziglio
9480df32fe ci: Disable leak error from Valgrind
For some reason under Fedora 31 the g_socket_client_connect call
from test-listen test caused Valgrind to detect a leak.
Note that the like at gtype.c (g_socket_client_connect) specifically
marks a memory block as malloc-like. Not sure if it's an issue
with Valgrind or with GLib, as a workaround disable the leak report.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-11-25 16:58:13 +00:00
Frediano Ziglio
d0614859cf ci: Fix for test-listen leak detection
This suppression was present in former glib.supp version however
the suppression in glib.supp was updated to only catch "reachable"
leaks.
However in test-listen test the allocation is done in a thread
causing the leak to become "definite".

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-11-25 16:58:11 +00:00
Frediano Ziglio
80f16f2f26 ci: Update glib.supp file
Sync with Glib master file.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-11-25 16:58:06 +00:00
Frediano Ziglio
34455d47a9 build: Cleanup old library flags
OpenGL and Slirp requirement were removed much time ago.
OpenGL was removed by c5c176a5c7
(cfr "server: remove OpenGL", Set 2013).
Slirp was removed by ef9a8bf053
(cfr "Remove tunneling support", Oct 2013).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2019-11-25 13:20:18 +00:00
Rosen Penev
1921d57160 reds: Fix compilation without deprecated OpenSSL 1.0.2 APIs
The threading API for 1.0 was replaced with the THREADID API.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-06 08:59:13 +00:00
Rosen Penev
5bc932f7a7 reds: Fix compilation without deprecated OpenSSL 1.1 APIs
Missing headers for BN_ and RSA_ functions.

Initialization is deprecated with 1.1.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-06 08:59:13 +00:00
Snir Sheriber
b5c296056e docs: Fix documents titles
-Remove BOM character if exists (this may interfere Static Site Generators)
-Use simple titles (SSG may use the title as the html file name)
-Fix title which violates the format
2019-10-31 16:44:17 +02:00
Frediano Ziglio
cfdb255b41 smart-channel-client: Remove spicec client reference from comment
spicec is an obsolete client.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-21 09:14:29 +01:00
Victor Toso
7f1481dce6 docs: update Makefile to match meson dist
Sort the files names in alphabetic order and include the .html
version for spice_for_newbies and spice_protocol

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-10-14 13:49:18 +01:00
Victor Toso
a3bf9f06b3 docs: include protocol and for-newbies documents
Only by building and sharing the documents we will be able to get them
up to date.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-10-14 13:48:49 +01:00
Frediano Ziglio
43fa3b549b docs: Update many names in spice_protocol.txt
Using an old "renames" file found in spice-protocol repository
I update some old names in the documentation protocol.
Also updated some other names manually.
I processed the file and fixed some code indentation.
File looks much more up to date.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-14 12:38:30 +01:00
Frediano Ziglio
5308ab84b9 event-loop: Change internal core interface
Allow to modify/cancel timers/watches without having to retrieve
the code interface.
This will make sure that you are not using the wrong interface.
Simplify code to deal with timers/watches.
Remove the requirement to have the core interface available
for removing timers/watches.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-10 10:55:52 +01:00
Frediano Ziglio
97d2d1f129 event-loop: Move adapter interface from reds.c
Put more event loop code in event-loop.c.
This is a preparation patch for the next one.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-10 10:55:38 +01:00
Frediano Ziglio
ebe676697f smartcard: Reset vheader value
The buffer could change inside smartcard_read_buf_prepare.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-10 10:51:59 +01:00
Frediano Ziglio
60a61be549 smartcard: Fix statement termination
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-10 10:51:48 +01:00
Frediano Ziglio
d8d5c48ad6 test-smardcard: Improve test coverage
Using coverage utility exercise more code paths:
- message from channel with wrong type;
- remove message from channel with already removed reader;
- init message from channel (ignored);
- data from devices, ADPU;
- error from device;
- messages split in different ways;
- invalid reader_id values.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-09 10:33:25 +01:00
Frediano Ziglio
344ce666cf test-smartcard: Add test for Smartcard device
Create Smardcard device.
Connect to it and test some messages are parsed and processed
as expected.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-09 10:33:25 +01:00
Frediano Ziglio
b4e508880a test-stream-device: Factor out VMC emulation
Allows to reuse code for emulating a character device.
It will be used for Smardcard test.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-09 10:33:25 +01:00
Frediano Ziglio
07d9328f89 smartcard: Fix parsing multiple messages from the device
This patch handles the scenario when a single read to guest device
brings multiple requests to be handled. When this happens, we will
iterate till all requests are handled and no more requests can be read
from guest device.

If the remaining buffer contains a full request we don't need to read
other bytes (note that there could be no bytes left), just parse the
request.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-09 10:33:22 +01:00
Frediano Ziglio
6fa12db104 smartcard: Fix copying remaining request
Use memmove instead of memcpy as the buffer can overlap if the second
request if bigger than the first.
"buf_pos" points to the point of the buffer after we read, if we want
the first part of the next request is "buf_pos - remaining".
Same consideration setting "buf_pos" for the next iteration.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-09 10:33:17 +01:00
Frediano Ziglio
57d02c2d17 smartcard: Do not crash if reader_id is invalid
Avoid client to trigger crash. The value of smartcard_readers_get
is checked for NULL so returning it it's not an issue.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-09 08:53:10 +01:00
Frediano Ziglio
18877d1af8 smartcard-channel-client: Use log instead of printf
More coherent. Also it's not good for a library to output on
standard output.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-09 08:53:06 +01:00
Frediano Ziglio
8d4d4e3a39 smartcard-channel-client: Remove properties code
Not used

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-09 08:45:25 +01:00
Frediano Ziglio
d546696424 red-channel-client: Use SpiceMsgcAckSync structure
red_channel_client_handle_message is called after parsing the
message so it's not necessary to check it again or parse manually.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-08 17:12:59 +01:00
Frediano Ziglio
2b56398c34 red-channel-client: Remove useless check
Message is checked by generated message parser.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-08 17:12:59 +01:00
Frediano Ziglio
774d466cf8 red-channel: Make parser function compulsory
As base messages require parsing better channels should always use
the generated parser.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-08 17:12:59 +01:00
Frediano Ziglio
bae2d1f00f smartcard: Use generated parse for messages
The generated code handle possible endianess mismatch and check
for message format.
The copy back to "write_buf" allows to use that buffer to send
data back to device.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-08 16:01:56 +01:00
Frediano Ziglio
5d2b204e48 Update spice-common submodule
This brings in the following changes:

Frediano Ziglio (1):
      proto: Demarshal Smartcard data field

Kevin Pouget (1):
      common/recorder.h: do not complain on unused (dummy) recorders

This is in preparation to use the generated code for Smartcard
(currently not used so won't create regressions).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-08 16:01:56 +01:00
Frediano Ziglio
33d81bc3fa smartcard-channel-client: Remove unused parameter
"name" parameter of smartcard_channel_client_add_reader it's not
used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-08 15:34:14 +01:00
Frediano Ziglio
6c5b7017ee ci: Update gitlab makecheck-centos Job to support CentOS 8
Disable celt0.51, now obsolete.
Update package names and repositories.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-10-04 15:39:00 +01:00
Victor Toso
e86d4e3e48 tests: migrate: fix migration with --vdagent option
Before this patch, running the test with --vdagent option would error
in the second migration attempt with:

 | qemu-system-x86_64: Unknown savevm section or instance
 | '0000:00:04.0/virtio-console' 0. Make sure that your current VM setup
 | matches your saved VM setup, including any hotplugged devices

The reason is that target host created for migration was lacking the
configuration for vdagent that is present in the first source/target
migration VMs.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-10-04 13:32:13 +02:00
Victor Toso
6777ec31f1 tests: migrate: wait user launch client option
Useful to test different clients running different tools (gdb,
valgrind).

Signed-off-by: Victor Toso <victortoso@redhat.com>
2019-10-04 13:31:55 +02:00
Victor Toso
878d3bd1ab tests: migrate: default to not launch client
This supports doing migration without any client to be connected.
If tester wants client, it needs to pass an option to --client.

Change of default still is to keep the test as simple as possible
when no arguments are given.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-10-04 13:31:20 +02:00
Victor Toso
bc928ad2a8 tests: migrate: add counter for tests
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:53 +02:00
Victor Toso
37507c928a tests: migrate: add option --wait-user-input
The iterate() method already considers it. This is useful if one wants
to attach gdb on qemu for instance.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:53 +02:00
Victor Toso
4241806de7 tests: migrate: bool instead of on/off option in cmd line
Simpler. Make the default to be False as well as
 1) No args should run as simple as possible
 2) True is currently broken

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:53 +02:00
Victor Toso
0d351864b1 tests: migrate: remove multiple client option
Not supported feature to be tested so reduce unused/untested code for
now.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:48 +02:00
Victor Toso
6ca34325f5 tests: migrate: fix relative qmp.py path
Moved in qemu, see:

 | commit 8f8fd9edba4bd6768da2c8e2bea49ad5c16ced1a
 | Author: Cleber Rosa <crosa@redhat.com>
 | Date:   Wed Feb 6 11:29:01 2019 -0500
 |
 |     Introduce a Python module structure
 |
 |     This is a simple move of Python code that wraps common QEMU
 |     functionality, and are used by a number of different tests and
 |     scripts.
 |
 |     By treating that code as a real Python module, we can more easily:
 |      * reuse code
 |      * have a proper place for the module's own unittests
 |      * apply a more consistent style
 |      * generate documentation

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:07 +02:00
Victor Toso
973779961f tests: migrate: add support to run with remote-viewer
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:07 +02:00
Victor Toso
a0a310befe tests: migrate: use uri for default's spicy client
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:07 +02:00
Victor Toso
f82cf87e65 tests: migrate: remove spicec option
Removed, see:

 | commit 1876971442
 | Author: Christophe Fergeau <cfergeau@redhat.com>
 | Date:   Fri Nov 21 11:01:17 2014 +0100
 |
 |     client: Remove client code
 |
 |     The client has been superseded by virt-viewer (
 |     http://virt-manager.org/download/sources/virt-viewer/ )
 |     and is no longer being maintained.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:07 +02:00
Frediano Ziglio
abbd985c78 spicevmc: Fix g_object_new call for 32 bit machines
"self-tokens" property is 64 bit and must be passed as 64 bit on
32 bit machines to avoid memory corruptions.
This was introduced by 01de3b8922 ("spicevmc: Avoids DoS if
guest device is not able to get data faster enough"), detected by CI.

It caused this error (split into multiple lines):

  (./test-leaks:15879): GLib-GObject-CRITICAL **: 14:03:59.650: \
  g_object_new_is_valid_property: object class 'RedCharDeviceSpiceVmc' has \
  no property named '\xb0/@\xf3\u0001'

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-09-24 16:22:46 +01:00
Frediano Ziglio
01de3b8922 spicevmc: Avoids DoS if guest device is not able to get data faster enough
This fix half (one direction) of
https://gitlab.freedesktop.org/spice/spice/issues/29.
Specifically if you have attempt to transfer a file from the client
using WebDAV.
Previously the queue to the device was unbound. If device was not
getting data fast enough the server started queuing data.
To easily test this you can suspend the WebDAV daemon while transferring
a big file from the client.
To simplify the code and reduce the changes server buffers are
used. This as client token implementation is written with agent
in mind. While when we exhaust server tokens RedCharDevice doesn't
close the client when we exhaust client tokens RedCharDevice closes
the client which in this case it's not wanted.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-09-24 13:38:01 +01:00