diff mbox series

ui/vnc: fix enabling of VNC_FEATURE_XVP

Message ID 20230925145034.530623-1-pbonzini@redhat.com
State New
Headers show
Series ui/vnc: fix enabling of VNC_FEATURE_XVP | expand

Commit Message

Paolo Bonzini Sept. 25, 2023, 2:50 p.m. UTC
VNC_FEATURE_XVP was not shifted left before adding it to vs->features,
so it was never enabled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 ui/vnc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel P. Berrangé Sept. 25, 2023, 3:43 p.m. UTC | #1
On Mon, Sep 25, 2023 at 04:50:34PM +0200, Paolo Bonzini wrote:
> VNC_FEATURE_XVP was not shifted left before adding it to vs->features,
> so it was never enabled.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  ui/vnc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

/facepalm

I definitely tested this code, because I had to use QEMU to
validate the GTK-VNC client implementation....


> 
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 6fd86996a54..3d13757b72b 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -2205,7 +2205,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
>              break;
>          case VNC_ENCODING_XVP:
>              if (vs->vd->power_control) {
> -                vs->features |= VNC_FEATURE_XVP;
> +                vs->features |= VNC_FEATURE_XVP_MASK;
>                  send_xvp_message(vs, VNC_XVP_CODE_INIT);
>              }
>              break;

....I made the same screwup when processing messages:


    case VNC_MSG_CLIENT_XVP:
        if (!(vs->features & VNC_FEATURE_XVP)) {
            error_report("vnc: xvp client message while disabled");
            vnc_client_error(vs);
            break;
        }

so the bugs (kinda) cancelled out. So you'll need to fix
both places

With regards,
Daniel
Paolo Bonzini Sept. 25, 2023, 3:58 p.m. UTC | #2
On 9/25/23 17:43, Daniel P. Berrangé wrote:
> On Mon, Sep 25, 2023 at 04:50:34PM +0200, Paolo Bonzini wrote:
>> VNC_FEATURE_XVP was not shifted left before adding it to vs->features,
>> so it was never enabled.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   ui/vnc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> /facepalm
> 
> I definitely tested this code, because I had to use QEMU to
> validate the GTK-VNC client implementation....
> 
> 
>>
>> diff --git a/ui/vnc.c b/ui/vnc.c
>> index 6fd86996a54..3d13757b72b 100644
>> --- a/ui/vnc.c
>> +++ b/ui/vnc.c
>> @@ -2205,7 +2205,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
>>               break;
>>           case VNC_ENCODING_XVP:
>>               if (vs->vd->power_control) {
>> -                vs->features |= VNC_FEATURE_XVP;
>> +                vs->features |= VNC_FEATURE_XVP_MASK;
>>                   send_xvp_message(vs, VNC_XVP_CODE_INIT);
>>               }
>>               break;
> 
> ....I made the same screwup when processing messages:
> 
> 
>      case VNC_MSG_CLIENT_XVP:
>          if (!(vs->features & VNC_FEATURE_XVP)) {
>              error_report("vnc: xvp client message while disabled");
>              vnc_client_error(vs);
>              break;
>          }
> 
> so the bugs (kinda) cancelled out. So you'll need to fix
> both places

Doh, I "assumed" it was a thinko coming from usage of vnc_has_feature 
elsewhere.  I will send v2.

Paolo
diff mbox series

Patch

diff --git a/ui/vnc.c b/ui/vnc.c
index 6fd86996a54..3d13757b72b 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2205,7 +2205,7 @@  static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
             break;
         case VNC_ENCODING_XVP:
             if (vs->vd->power_control) {
-                vs->features |= VNC_FEATURE_XVP;
+                vs->features |= VNC_FEATURE_XVP_MASK;
                 send_xvp_message(vs, VNC_XVP_CODE_INIT);
             }
             break;