[Spice-devel] [PATCH 1/1] Allow missing capabilities from source host

Christophe Fergeau cfergeau at redhat.com
Fri Oct 23 06:09:24 PDT 2015


Hey,

On Mon, Sep 21, 2015 at 02:13:44PM +0100, Dr. David Alan Gilbert (git) wrote:
> 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).

I don't think this was picked up? Hans, are you planning to pick this
up, or do you need help with the reviewing/testing?

Thanks,

Christophe

> 
> 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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151023/dea57362/attachment.sig>


More information about the Spice-devel mailing list