[Spice-devel] [PATCH 1/1] Allow missing capabilities from source host
Dr. David Alan Gilbert (git)
dgilbert at redhat.com
Mon Sep 21 06:13:44 PDT 2015
From: "Dr. David Alan Gilbert" <dgilbert at redhat.com>
When loading a USB redirection stream during a qemu
migration, the source QEMU might be earlier and be missing
a bunch of capabilities that are now available in a more modern
version; allow this migration to work as long as the source
isn't claiming any capabilities that we don't have.
(We should be a bit more careful about this in future in qemu;
we could tie any new capabilities we ask for to machine types).
Signed-off-by: Dr. David Alan Gilbert <dgilbert at redhat.com>
---
usbredirparser/usbredirparser.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/usbredirparser/usbredirparser.c b/usbredirparser/usbredirparser.c
index 8076b72..d1f9850 100644
--- a/usbredirparser/usbredirparser.c
+++ b/usbredirparser/usbredirparser.c
@@ -1682,10 +1682,24 @@ int usbredirparser_unserialize(struct usbredirparser *parser_pub,
memcpy(orig_caps, parser->our_caps, i);
if (unserialize_data(parser, &state, &remain, &data, &i, "our_caps"))
return -1;
- if (memcmp(parser->our_caps, orig_caps,
- USB_REDIR_CAPS_SIZE * sizeof(int32_t)) != 0) {
- ERROR("error unserialize caps mismatch");
- return -1;
+ for (i =0; i < USB_REDIR_CAPS_SIZE; i++) {
+ if (parser->our_caps[i] != orig_caps[i]) {
+ /* orig_caps is our original settings
+ * parser->our_caps is off the wire.
+ * We want to allow reception from an older
+ * usbredir that doesn't have all our features.
+ */
+ if (parser->our_caps[i] & ~orig_caps[i]) {
+ /* Source has a cap we don't */
+ ERROR("error unserialize caps mismatch ours: %x recv: %x",
+ orig_caps[i], parser->our_caps[i]);
+ return -1;
+ } else {
+ /* We've got a cap the source doesn't - that's OK */
+ WARNING("unserialize missing some caps; ours: %x recv: %x",
+ orig_caps[i], parser->our_caps[i]);
+ }
+ }
}
data = (uint8_t *)parser->peer_caps;
--
2.5.0
More information about the Spice-devel
mailing list