Commit Graph

328 Commits

Author SHA1 Message Date
Marc-André Lureau
eeb95c5b84 server: add reds_stream_{read,write,free,remove_watch}()
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:25 +03:00
Marc-André Lureau
881971fbca server: s/RedsStreamContext/RedsStream
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:25 +03:00
Marc-André Lureau
a1ef838d34 server/reds: remove unused readv
Let's not bother with it since nobody uses it, and it's not implemented for SSL anyway

https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:25 +03:00
Marc-André Lureau
e1cfe664c4 build: make it silent
This patch make it easier to spot warnings in compilation.  It should
work with older versions of automake that don't support silent rules.

If you want verbose build, make V=1.

Signed-off-by: Uri Lublin <uril@redhat.com>

https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-07-21 15:09:25 +03:00
Alon Levy
fcd4a8e446 server/red_channel: fix segfault on red_channel_destroy if peer already removed 2011-07-21 15:09:25 +03:00
Alon Levy
58f79a98b6 server/tests: Makefile.am: use AM_LDFLAGS instead of LDFLAGS 2011-07-21 15:08:32 +03:00
Alon Levy
ae7659fea9 server/red_channel: error channel if alloc_msg_buf fails (returns NULL) 2011-07-21 15:08:32 +03:00
Gerd Hoffmann
89accad2bf server: add symbol versioning to the spice server shared library.
This patch adds symbol versions to the spice server library.  Each
symbol which is exported by libspice-server gets tagged with the
(stable) version where it appeared first.  This way the linker and rpm
are able to figure which version of the spice-server libary is required
by a particular qemu binary/package.

[ 0.8 branch: drop 0.10 symbols from list ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-07-19 14:41:10 +02:00
Alon Levy
529dc40dc3 server/smartcard: fix use after free 2011-05-24 16:11:26 +03:00
Hans de Goede
443994ba87 server: make sure we clear vdagent and update mouse mode on agent disconnect
The check this patch removes causes us to not set vdagent to NULL, nor
update the mouse mode when the guest agent disconnects when no client is
attached. Which leads to a non working mouse, and on agent reconnect a
"spice_server_char_device_add_interface: vdagent already attached" message
instead of a successful re-add of the agent interface .
2011-04-01 16:46:55 +02:00
Hans de Goede
620a02da31 server: ignore SPICE_MSGC_MAIN_AGENT_START messages when there is no agent
This can happen for example when a SPICE_MSGC_MAIN_AGENT_START message
from the client and the vdagent disconnecting race.
2011-04-01 16:45:50 +02:00
Hans de Goede
2df49c8a67 server: hookup agent-msg-filter discard-all functionality
This ensures that if the client or agent connects to the client-agent
"tunnel" while the other side is halfway through sending a multi part
message, the rest of the message gets discarded, and the connecting
party starts getting data at the beginning of the next message.
2011-04-01 16:31:37 +02:00
Hans de Goede
5d7cf4c002 server: add discard all option to agent message filter 2011-04-01 14:22:44 +02:00
Hans de Goede
1ec316e561 server: filter all data from client
Filter all data from client, even when there is no agent connected
to keep filter state correct.
2011-04-01 14:14:00 +02:00
Hans de Goede
add4bedb2f server: reset read/write filter on agent/client disconnect
The agent message filter keeps track of messages as they are being send
reset the relevant filter to its initial state when one of the 2 ends
of the agent<->client "tunnel" disconnects.
2011-04-01 14:08:56 +02:00
Hans de Goede
a19f51265c server: break read_from_vdi_port loop if the guest gets disconnected
read_from_vdi_port calls dispatch_vdi_port data, which will disconnect
the guest agent if it sends invalid data. It would then try to read more
data from the disconnected guest agent resulting in a NULL ptr dereference,
this patch fixes this.
2011-04-01 11:13:50 +02:00
Hans de Goede
7cc85f33be server: Don't stop writing agent data to the guest when the client disconnects
write_to_vdi_port() was checking for reds->agent_state.connected to determine
wether it could write queued data. But agent_state.connected reflects if
*both* ends are connected. If the client has disconnected, but the guest agent
is still connected and some data is still pending (like a final clipboard
release from the client), then this data should be written to the guest agent.
2011-04-01 11:13:50 +02:00
Hans de Goede
ef6886732e server: Don't reset agent state when the client disconnects
We were calling reds_reset_vdp on client disconnect, which is not a good
idea. reds_reset_vdp does 3 things:

1) It resets the state related to reading chunks from the spicevmc virtio
   port. If the client disconnects while the guest agent is in the middle
   of sending a chunk, this will lead to an inconsistent state, and lots
   of printing of "dispatch_vdi_port_data: invalid port" messages caused
   by this inconsistent state sometimes followed by a segfault.

   This can be triggered by copy and pasting something large (say
   a screenshot) from the guest to the spice-gtk client, as the spice-gtk
   client currently has a bug causing it to crash when receiving a multi
   chunk vdagent messages. Without this patch (and with the spice-gtk bug
   present) I can consistently reproduce this.

2) It clears any buffered writes from the client to the guest still pending
   because the virtio port cannot consume data fast enough. Since the agent
   itself is still running fine, throwing away writes for it because the
   client has disconnected makes no sense. Esp, since on clean exit the
   client may very well send a clipboard release message directly
   before closing the connection, and this may get lost this way.

3) It sets client_agent_started to false, this is the only thing which
   actually makes sense to do on client disconnect.

Note that since we no longer reset the vdp state on client disconnect, we
must now reset it on agent disconnect even if we don't have a client. So
the reds_reset_vdp call in reds_agent_remove() gets moved to the top,
above both the agent_state.connected and reds->peer checks which will
both fail in the no client case.
2011-04-01 11:13:46 +02:00
Hans de Goede
302ab69f5b server: Make copy paste support configurable
Also bump SPICE_SERVER_VERSION to 0x000801 as 0.8.1 will be the
first version with the new API for this, and we need to be able to
detect the presence of this API in qemu.
2011-03-24 17:24:31 +01:00
Hans de Goede
0417117417 spice-server: Add the ability to filter agent messages 2011-03-24 17:24:31 +01:00
Alon Levy
5315888a70 server/reds: allow call to reds_agent_remove even if it is gone
The current assert(reds->agent_state.connected) tiggers if when
the agent disconnected there was still data waiting to be sent (for
instance if there is a bug in the client handling clipboard and it
is killed while a large clipboard transfer is in progress). So first
call to reds_agent_remove happens from spice_server_char_device_remove_interface,
and then it is called again (triggering the assert) from free_item_data
from read_from_vdi_port because of the channel destruction.

Other option would be to not call it from one of the paths - but that
is suboptimal:
 * if there is no data in the pipe, the second call never happens.
 * the second call has to be there anyway, because it may fail during
  parsing data from the agent.

This patch fixes a segfault on this assert when a client starts passing
from guest agent to client a large clipboard and dies in the middle. There
is still another assert happening occasionally at marshaller which I don't
have a fix for (but it doesn't seem to be related).
2011-03-08 21:49:21 +02:00
Hans de Goede
7fd8b7c971 Release 0.8.0 2011-03-01 19:40:36 +02:00
Gerd Hoffmann
aa827c5b99 fix spice-server segfault on migration
spice-server tries to use the migration information without checking
whenever this is available in the first place ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-02-15 11:24:28 +01:00
Hans de Goede
822fea8b32 Release 0.7.3 2011-02-11 15:37:54 +01:00
Alon Levy
5ed4050992 server/smartcard: don't push our own error on reader add
The device already sends one. There are actually two connections going
on:
 server to client - this is the smartcard channel, it reuses the VSC protocol.
 server to device - this is an internal connection using VSC too.

We generally just passthrough all messages from the client to the device,
and from the device to the client. We only rewrite the reader_id because
the device knows about a single id (it is actually a card id), and we
may manage more then one in the future.

Bottom line is that there was an extra VSC_Error message reaching the client.
2011-02-10 10:34:53 +02:00
Alon Levy
0d6550ed60 server/smartcard: ignore VSC_Init from client 2011-02-10 10:34:42 +02:00
Alon Levy
21d1ec600b server/smartcard: print instead of assert on bad reader_id in smartcard_char_device_on_message_from_device 2011-02-10 10:34:37 +02:00
Alon Levy
b05c744f4a server/smartcard: libcacard uses network byte order, so we must too 2011-02-10 10:34:32 +02:00
Alon Levy
ed5e2fc942 server/smartcard: libcacard removed ReaderAddResponse 2011-02-10 10:34:16 +02:00
Alon Levy
efa3704dbc server/smartcard: s/reader_id_t/uint32_t/ (libcacard changed) 2011-02-10 10:20:49 +02:00
Alon Levy
9de4c94a5d server/red_worker: fix used but uninitialized warning (gcc 4.6.0) 2011-02-07 18:51:50 +02:00
Alon Levy
54c91e89fb client/server: warning fixes (gcc 4.6.0)
gcc 4.6.0 added "[-Werror=unused-but-set-variable]", this and the next
few fixes tend to that. Mostly harmless.
2011-01-27 12:48:25 +02:00
Alon Levy
a7b66f77ba client/server: add missing USE_TUNNEL
disable some code that only makes sense when USE_TUNNEL is defined
in client and server channel security level setting.
2011-01-25 17:17:35 +02:00
Alon Levy
079acd9912 client/server: add missing smartchannel channel security handling
The name to channel id mapping for the smartcard channel is missing,
add it in client and server.
2011-01-25 17:17:29 +02:00
Hans de Goede
5c4fb47825 Update license header for server/red_parse_qxl.c
This one mistakenly had a GPL header rather then an LGPL header.
2011-01-21 21:35:23 +01:00
Hans de Goede
50a4db1710 Release 0.7.2 2011-01-19 15:04:56 +01:00
Alon Levy
2a9f35a98f server/red_worker: use 1, not 4 when lz_encoding a top down image 2011-01-17 18:48:50 +02:00
Hans de Goede
998218be17 Release 0.7.1 2010-12-17 14:18:14 +01:00
Hans de Goede
abbc024b09 Makefiles: fix server/tests/test_util.h not being included in make dist 2010-12-17 14:14:45 +01:00
Hans de Goede
504ffab58d server: Update SPICE_SERVER_VERSION 2010-12-17 13:53:33 +01:00
Alon Levy
5cea338954 server/red_worker: fix worker->drawable_count
drawable_count was becoming negative. It tracks the number of
items in the worker->current_list ring. It was decremented correctly,
but incremented only in several cases. The cases it wasn't incremented
where:
 red_current_add_equal found an equivalent drawable
by moving the increment to where the item is added to current_list, in
__current_add_drawable, the accounting remains correct.

This has no affect other then correct accounting, as drawable_count isn't
used for anything.
2010-12-16 16:23:04 +01:00
Gerd Hoffmann
bca5403370 move chardevs out of experimental
While we are at it:  There is no reason for chardev
support to stay in the experimental area, so move it out.
qemu should not need the "spice-experimental.h" file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 7bbc2ba090)
2010-12-16 09:17:42 +01:00
Gerd Hoffmann
215cd7f903 move switch-host migration out of experimental
seamless stays in the experimental area.
comments updates too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 6acb817071)
2010-12-16 09:17:35 +01:00
Gerd Hoffmann
697c91db80 client migration: switch host
Implement server-side support for switch-host client migration.  Client
side support is present already in the tree.

Setting the migration information is done using the existing
spice_server_migrate_info() function.  A new
spice_server_migrate_switch() function has been added which triggers
sending out the switch-host message.

Seamless migration functions are left there for now.
spice_server_migrate_start() has been chamnged to just fail
unconditionally though as seamless migration is broken anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 4b1ea4e102)
2010-12-16 09:17:29 +01:00
Gerd Hoffmann
14fef1954f server: improve error handling
We should pass up errors instead of aborting.  Do that at least
for bind() failures which actually happen in real live due to the
tcp port being busy.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit aafd8eea74)
2010-12-09 22:06:58 +01:00
Alon Levy
7e0a1dfa75 smartcard: configure option --enable-smartcard 2010-12-07 13:31:44 +02:00
Alon Levy
d99ec6c35b smartcard: server side (not enabled yet) 2010-12-07 13:31:42 +02:00
Alon Levy
7461ee17cf server: add spice_server_char_device_remove_interface 2010-12-07 13:31:28 +02:00
Alon Levy
5220e0a706 server: print subtype when adding CHAR_DEVICE interfaces 2010-12-06 18:09:15 +02:00
Alon Levy
0ac9ca51f4 server: add static to spice_server_char_device_add_interface 2010-12-06 18:09:15 +02:00