Commit Graph

2875 Commits

Author SHA1 Message Date
Victor Toso
e005e7017b clang: Don't compute absolute value of unsigned
Clang's warning on absolute-value.

> red-record-qxl.c:297:39: error: taking the absolute value of unsigned
> type 'uint32_t' (aka 'unsigned int') has no effect
>     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
>                                   ^
> red-record-qxl.c:297:39: note: remove the call to 'abs' since unsigned
> values cannot be negative
>     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
>                                   ^~~

> red-replay-qxl.c:471:39: error: taking the absolute value of unsigned type
> 'uint32_t' (aka 'unsigned int') has no effect
>     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
>                                   ^
> red-replay-qxl.c:471:39: note: remove the call to 'abs' since unsigned
> values cannot be negative
>     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
>                                   ^~~

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-01-08 10:20:02 +00:00
Frediano Ziglio
4458cc372b display-channel: Limit number of surfaces to 1024
Qemu never used more than this number and today surfaces are not
much used so there's no reason to keep this limit so high.
This reduces quite a lot some internal structure
(DisplayChannelPrivate and DisplayChannelClientPrivate).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-01-08 09:59:59 +00:00
Frediano Ziglio
7362882993 red-stream: Avoid infinite loop on sasl_encode/decode failure
These functions do not set errno so it is possible that errno has a
stale value which happens to be EAGAIN.
This would cause an infinite loop in functions like red_stream_write_all
(or potentially using the event loop).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-04 20:08:17 +00:00
Frediano Ziglio
cb099522bf red-stream: Avoid to specify 2 mech names during SASL
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2018-01-02 11:39:36 +00:00
Frediano Ziglio
f3be28fb5e red-stream: Simplify mechname matching
Avoid over complicated matching using quoting and a simple strstr
operation.
The mech names are separated and quoted with the same chararacter (',')
making possible to search for ",MECHNAME," instead of manually check for
prefix and suffix after the search for "MECHNAME".

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2018-01-02 11:39:15 +00:00
Frediano Ziglio
521353639b main-channel-client: Do not call red_channel_client_begin_send_message if we are not sending a message
In case mcc->priv->initial_channels_list_sent is false we didn't
marshall any message so we should not call
red_channel_client_begin_send_message.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-12-19 17:05:48 +00:00
Frediano Ziglio
f7ca5d4a15 red-stream: Use mechname for mechname
There's no reason to copy mechname into mechlist to use mechlist
instead of mechname.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-12-19 16:55:13 +00:00
Frediano Ziglio
a7b8ea4b7a red-stream: Remove SASL "data" field leak
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-12-19 16:55:11 +00:00
Frediano Ziglio
58e8bf6439 reds: Remove argument from reds_handle_link
RedLinkInfo stores reds in it no need to pass every time.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-12-19 16:55:07 +00:00
Frediano Ziglio
52d8dd6898 inputs-channel: Move spice_server_kbd_leds to InputsChannel
This avoids to expose some detail about the channel.
Like other APIs implement it move close to the part that handle
it instead of have everything in reds.c.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-12-19 16:29:41 +00:00
Frediano Ziglio
a793655a86 display-channel: Reuse GLIST_FOREACH macro in drawable_remove_from_pipes
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-12-19 16:28:19 +00:00
Frediano Ziglio
5b5d9b1f51 red-pipe-item: Move typedef at the top to avoid a "struct RedPipeItem"
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-12-19 16:28:17 +00:00
Frediano Ziglio
f0d40082b0 dcc: Remove obsolete comment
RedPipeItem does not contain a link anymore.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-12-19 16:28:09 +00:00
Frediano Ziglio
bde8ef5a4e stat-file: Protect flags field with atomic operation
Coverity complaint that this field should be protected by
a mutex as other accesses are with the mutex locked.
Use atomic operation. Not in an hot path in any case.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2017-12-19 12:18:56 +00:00
Frediano Ziglio
fc1005718f build-sys: Ignore generated test-channel and test-stream-device files
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2017-12-17 17:33:07 +00:00
Frediano Ziglio
a1a64a41f8 reds: Remove unused SASL_DATA_MAX_LEN define
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-14 07:48:36 +00:00
Frediano Ziglio
83c5fa8d32 reds: Remove possible leak during SASL authentication
We need to free the connection if the mechanism name is wrong

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2017-12-14 07:48:31 +00:00
Frediano Ziglio
158ab5f921 display-channel: Remove unused parameter from drawable_remove_dependencies
It's not used since its introduction at 4e8f24e351.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-13 12:18:19 +00:00
Frediano Ziglio
07396a4c80 Move RedUpgradeItem declaration in video-stream.h
This structure is used to send a message related to streams.
There are already other items defined in video-stream.h so
move the declaration.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-12 17:25:55 +00:00
Frediano Ziglio
b25091801c video-stream: Simplify update_client_playback_delay
Avoid one step to retrieve reds pointer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-12 17:25:53 +00:00
Frediano Ziglio
b2ade6e996 Simplify sending stream report activation message
Store information directly in the RedStreamActivateReportItem
making easier to marshall the message.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-12 17:25:50 +00:00
Frediano Ziglio
7ed7686de1 video-stream: Reuse display variable
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-12 17:25:47 +00:00
Frediano Ziglio
0c5ff195ad video-stream: Initialise VideoStreamClipItem directly
Instead of just allocating in video_stream_clip_item_new and
than have to setup properly in dcc_video_stream_agent_clip
do all in video_stream_clip_item_new which is more consistent
with other part of the code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-12 17:25:42 +00:00
Uri Lublin
2d0d872775 sound: fix params order when calling snd_desired_audio_mode
Make sure client_can_celt is passed before client_can_opus

The bug was present since introduction of opus in ce9b714137

Found by Coverity.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-12 18:37:17 +02:00
Frediano Ziglio
ebcfa426e4 reds: Fix typo in declaration
recs -> reds

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-12 07:03:02 +00:00
Frediano Ziglio
7cbc80ed04 build-sys: Remove useless definition
The default LDADD already include libserver.la.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-12 06:59:25 +00:00
Uri Lublin
ee87a36e95 test-stream: initialize msg.msg_flags
Coverity complains the field is not initialized.
That's true but man recvmsg specifies that this
field is set by recvmsg.

To make coverity happy, initialize this field.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-11 10:16:11 +00:00
Uri Lublin
1a16419431 reds_init_socket: do not leak slisten on error
Found by Coverity.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-11 10:15:13 +00:00
Christophe Fergeau
7ff434b104 ssl: Drop support for older OpenSSL versions
SSL_OP_NO_COMPRESSION was introduced in OpenSSL_0_9_8k, which is no
longer supported. This commit raises the minimum OpenSSL version to
1.0.0, which is also out of support.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-08 15:22:26 +01:00
Christophe Fergeau
dd8e205aaf worker: Remove unneeded include
Nothing seems to be using openssl in red-worker.c

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-08 15:22:16 +01:00
Christophe Fergeau
1170282cec build: Use $(srcdir) when it makes sense
There are a few places which use $(top_srcdir) when $(srcdir) would be
equally valid.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-08 14:30:51 +01:00
Christophe Fergeau
c9b9a5fd35 build: Rebuild shared library when symbol file changes
At the moment, changing spice-server.syms to add/remove a new symbol to
be exported does not regenerate spice-server.so. This commit added the
needed dependency for this to work.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-08 14:30:45 +01:00
Frediano Ziglio
e030f87cf0 Do not compute stream_id more that necessary
Reuse already computed value and avoid to compute in every
iterations.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-07 16:11:46 +00:00
Frediano Ziglio
fb85723433 reds: Remove RedVDIReadBuf pooling code
Originally this pool was used to avoid allocation/deallocations.
However the introduction of GList cause the code to do dynamic
allocations in order to update the list making this pooling
something useless.
The buffers limitation is now implemented with a simple counter.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-07 16:04:10 +00:00
Frediano Ziglio
7569ff3cc8 test-vdagent: Remove useless MIN definition
Already defined by GLib headers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Maybe this check should just be removed?
2017-12-05 10:54:09 +00:00
Frediano Ziglio
60d8389bcd Handle SPICE_MSGC_DISCONNECTING message in RedChannelClient
There's no reason to handle this message in a different
way in MainChannel and InputsChannel, the default handling
will return true in any case.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Maybe this check should just be removed?
2017-12-05 10:54:09 +00:00
Frediano Ziglio
89c5d062d6 reds: Fix wrong assert
RedVDIReadBuf::data is a static allocated buffer so checking for
NULL on it is useless. It would be NULL only if RedVDIReadBuf
pointer would be the opposite, in value, of the offset of
data field into it.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-05 10:54:09 +00:00
Frediano Ziglio
ecd9968e91 main-channel: Put all migration message handling together
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-05 10:54:09 +00:00
Frediano Ziglio
57e20c1a2d main-channel: Remove brackets if not needed
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-05 10:54:09 +00:00
Frediano Ziglio
3fa1623482 main-channel: Remove useless check
If there is a channel client there's surely a related channel.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-05 10:54:09 +00:00
Frediano Ziglio
fc8e55b77b reds: Remove leak of agent_dev
This object was not freed.
Also free object buffers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-05 10:54:03 +00:00
Frediano Ziglio
967876d27d reds: Use GLib memory functions for RedVDIReadBuf
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-05 10:51:37 +00:00
Jonathon Jongsma
a337808fa4 StreamDevice: assert preconditions in parsing functions
Be a bit more defensive about handling incoming messages from the stream
device. This also makes these functions consistent with
handle_msg_format(). These assertions are only enabled if
ENABLE_EXTRA_CHECKS is defined.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-12-05 09:00:34 +00:00
Frediano Ziglio
0b9e5e87e1 inputs-channel: Prefer channel core over global core interface
Potentially a channel can run with a different core interface
than the global one attached to RedsState so instead of calling
reds_core_* functions use the code interface attached to the
channel.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-01 22:53:05 +00:00
Frediano Ziglio
a73357f33e inputs-channel: Encapsulate SpiceTabletState
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-01 22:51:05 +00:00
Frediano Ziglio
ddf7b366b1 Use verify instead of G_STATIC_ASSERT
verify guarantee that the condition is always a compile
time constant.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-01 22:49:46 +00:00
Frediano Ziglio
8e276278e5 tests: Use GLib memory functions
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-01 22:31:52 +00:00
Frediano Ziglio
9872e7b8e5 Reduce dependencies from red-qxl.h
This header is mainly exporting functions to handle public
interface for the QXL devices.
Avoid spreading its inclusion including this header in other
headers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-01 22:19:31 +00:00
Frediano Ziglio
a891d53a4c red-channel-client: Rename item_in_pipe to item_sent
The name is more consistent with the value of the flag and
the function red_channel_client_wait_pipe_item_sent where
the MarkerPipeItem structure is used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-12-01 22:15:16 +00:00
Frediano Ziglio
1ebe2e6d28 stream: Remove unused display parameter
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-01 16:51:44 +00:00