From nobody Sat Nov 15 10:35:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1752662141; cv=none; d=zohomail.com; s=zohoarc; b=lV/oJUGWHIkcjLsrWmkkN1RvS5A0fSK0TOh4TpmRy52021QwGkmIiNI3V8Wvv7rZHE9sCEUHv3HY61HluqU5UVneUXfKdPJ5mShOPSdb5Hr+JZVqWHIFdPjOKHRUljgfe0uCwkq4/oH+q12w+eQcgOUu5QDyPcdFXoqm409wbwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752662141; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UOhlCuEKYr9/tPFw9K8nUAoTkbz7CKklXhlHIsL4KP0=; b=MlUXH4IyYlc/7PIpYePkjUInMw5DWxK8UTXWuT1uplNyj8PSBruYVBDzCeFs8ff3QIjF0banyYmVQLN7/xecQqlXCyEcxO7pA7CI1X31OLVFzf8ez4WWcsZ7pvJta3T3GfgOqZMnudP/c6Kyiqumoh+qZXvSRZn2qJbUm0Ntcco= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752662141028120.63298028251995; Wed, 16 Jul 2025 03:35:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ubzTk-0004Ag-NW; Wed, 16 Jul 2025 06:35:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ubzP7-0000FO-5K for qemu-devel@nongnu.org; Wed, 16 Jul 2025 06:30:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ubzP4-0005b8-35 for qemu-devel@nongnu.org; Wed, 16 Jul 2025 06:30:24 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-dw5YvsBgP_apfpMfgs8iyA-1; Wed, 16 Jul 2025 06:30:18 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7457D1800D89; Wed, 16 Jul 2025 10:30:17 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.68]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ECC121954216; Wed, 16 Jul 2025 10:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752661821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UOhlCuEKYr9/tPFw9K8nUAoTkbz7CKklXhlHIsL4KP0=; b=csja2MJWQmwjeh00yT7IvQeQEzvQabBc1iLjPb9EsSJk1DqwLDaZe2BB1/wxn5kZIvOILk yFxm2B8oklOgmcfEM7j6s0yFaaxjSdSZJRnkB96DAiZcWnUKpb/PpiyeA5gGiEf9Xvdoo/ 8AUJo2RMGwf1KJaNisjZ6Y65hg9oDhA= X-MC-Unique: dw5YvsBgP_apfpMfgs8iyA-1 X-Mimecast-MFC-AGG-ID: dw5YvsBgP_apfpMfgs8iyA_1752661817 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 2/4] ui: add trace events for all client messages Date: Wed, 16 Jul 2025 11:30:07 +0100 Message-ID: <20250716103009.2047433-3-berrange@redhat.com> In-Reply-To: <20250716103009.2047433-1-berrange@redhat.com> References: <20250716103009.2047433-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1752662142420116600 This lets us see the full flow of RFB messages received from the client. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Daniel P. Berrang=C3=A9 --- ui/trace-events | 14 +++++++++++++ ui/vnc.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/ui/trace-events b/ui/trace-events index 3da0d5e280..3eba9ca3a8 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -48,13 +48,27 @@ vnc_msg_server_ext_desktop_resize(void *state, void *io= c, int width, int height, vnc_msg_client_audio_enable(void *state, void *ioc) "VNC client msg audio = enable state=3D%p ioc=3D%p" vnc_msg_client_audio_disable(void *state, void *ioc) "VNC client msg audio= disable state=3D%p ioc=3D%p" vnc_msg_client_audio_format(void *state, void *ioc, int fmt, int channels,= int freq) "VNC client msg audio format state=3D%p ioc=3D%p fmt=3D%d channe= ls=3D%d freq=3D%d" +vnc_msg_client_cut_text(void *state, void *ioc, int len) "VNC client msg c= ut text state=3D%p ioc=3D%p len=3D%u" +vnc_msg_client_cut_text_ext(void *state, void *ioc, int len, int flags) "V= NC client msg cut text state=3D%p ioc=3D%p len=3D%u flags=3D%u" +vnc_msg_client_ext_key_event(void *state, void *ioc, int down, int sym, in= t keycode) "VNC client msg ext key event state=3D%p ioc=3D%p down=3D%u sym= =3D%u keycode=3D%u" +vnc_msg_client_framebuffer_update_request(void *state, void *ioc, int incr= emental, int x, int y, int w, int h) "VNC client msg framebuffer update req= uest state=3D%p ioc=3D%p incremental=3D%u x=3D%u y=3D%u w=3D%u h=3D%u" +vnc_msg_client_key_event(void *state, void *ioc, int down, int sym) "VNC c= lient msg key event state=3D%p ioc=3D%p down=3D%u sym=3D%u" +vnc_msg_client_pointer_event(void *state, void *ioc, int button_mask, int = x, int y) "VNC client msg pointer event state=3D%p ioc=3D%p button_mask=3D%= u x=3D%u y=3D%u" vnc_msg_client_set_desktop_size(void *state, void *ioc, int width, int hei= ght, int screens) "VNC client msg set desktop size state=3D%p ioc=3D%p siz= e=3D%dx%d screens=3D%d" +vnc_msg_client_set_encodings(void *state, void *ioc, int limit) "VNC clien= t msg set encodings state=3D%p ioc=3D%p limit=3D%u" +vnc_msg_client_set_pixel_format(void *state, void *ioc, int bpp, int big_e= ndian, int true_color) "VNC client msg set pixel format state=3D%p ioc=3D%p= bpp=3D%u big_endian=3D%u true_color=3D%u" +vnc_msg_client_set_pixel_format_rgb(void *state, void *ioc, int red_max, i= nt green_max, int blue_max, int red_shift, int green_shift, int blue_shift)= "VNC client msg set pixel format RGB state=3D%p ioc=3D%p red_max=3D%u gree= n_max=3D%u blue_max=3D%u red_shift=3D%u green_shift=3D%u blue_shift=3D%u" +vnc_msg_client_xvp(void *state, void *ioc, int version, int action) "VNC c= lient msg XVP state=3D%p ioc=3D%p version=3D%u action=3D%u" vnc_client_eof(void *state, void *ioc) "VNC client EOF state=3D%p ioc=3D%p" vnc_client_io_error(void *state, void *ioc, const char *msg) "VNC client I= /O error state=3D%p ioc=3D%p errmsg=3D%s" vnc_client_connect(void *state, void *ioc) "VNC client connect state=3D%p = ioc=3D%p" vnc_client_disconnect_start(void *state, void *ioc) "VNC client disconnect= start state=3D%p ioc=3D%p" vnc_client_disconnect_finish(void *state, void *ioc) "VNC client disconnec= t finish state=3D%p ioc=3D%p" vnc_client_io_wrap(void *state, void *ioc, const char *type) "VNC client I= /O wrap state=3D%p ioc=3D%p type=3D%s" +vnc_client_pixel_format(void *state, void *ioc, int bpp, int depth, int en= dian) "VNC client pixel format state=3D%p ioc=3D%p bpp=3D%u depth=3D%u endi= an=3D%u" +vnc_client_pixel_format_red(void *state, void *ioc, int max, int bits, int= shift, int mask) "VNC client pixel format red state=3D%p ioc=3D%p max=3D%u= bits=3D%u shift=3D%u mask=3D%u" +vnc_client_pixel_format_green(void *state, void *ioc, int max, int bits, i= nt shift, int mask) "VNC client pixel format green state=3D%p ioc=3D%p max= =3D%u bits=3D%u shift=3D%u mask=3D%u" +vnc_client_pixel_format_blue(void *state, void *ioc, int max, int bits, in= t shift, int mask) "VNC client pixel format blue state=3D%p ioc=3D%p max=3D= %u bits=3D%u shift=3D%u mask=3D%u" vnc_client_throttle_threshold(void *state, void *ioc, size_t oldoffset, si= ze_t offset, int client_width, int client_height, int bytes_per_pixel, void= *audio_cap) "VNC client throttle threshold state=3D%p ioc=3D%p oldoffset= =3D%zu newoffset=3D%zu width=3D%d height=3D%d bpp=3D%d audio=3D%p" vnc_client_throttle_incremental(void *state, void *ioc, int job_update, si= ze_t offset) "VNC client throttle incremental state=3D%p ioc=3D%p job-updat= e=3D%d offset=3D%zu" vnc_client_throttle_forced(void *state, void *ioc, int job_update, size_t = offset) "VNC client throttle forced state=3D%p ioc=3D%p job-update=3D%d off= set=3D%zu" diff --git a/ui/vnc.c b/ui/vnc.c index a16be468b9..c309882ddb 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2314,6 +2314,25 @@ static void set_pixel_format(VncState *vs, int bits_= per_pixel, vs->client_pf.bytes_per_pixel =3D bits_per_pixel / 8; vs->client_pf.depth =3D bits_per_pixel =3D=3D 32 ? 24 : bits_per_pixel; vs->client_endian =3D big_endian_flag ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; + trace_vnc_client_pixel_format(vs, vs->ioc, + vs->client_pf.bits_per_pixel, + vs->client_pf.depth, + vs->client_endian); + trace_vnc_client_pixel_format_red(vs, vs->ioc, + vs->client_pf.rmax, + vs->client_pf.rbits, + vs->client_pf.rshift, + vs->client_pf.rmask); + trace_vnc_client_pixel_format_green(vs, vs->ioc, + vs->client_pf.gmax, + vs->client_pf.gbits, + vs->client_pf.gshift, + vs->client_pf.gmask); + trace_vnc_client_pixel_format_blue(vs, vs->ioc, + vs->client_pf.bmax, + vs->client_pf.bbits, + vs->client_pf.bshift, + vs->client_pf.bmask); =20 if (!true_color_flag) { send_color_map(vs); @@ -2388,6 +2407,17 @@ static int protocol_client_msg(VncState *vs, uint8_t= *data, size_t len) if (len =3D=3D 1) return 20; =20 + trace_vnc_msg_client_set_pixel_format(vs, vs->ioc, + read_u8(data, 4), + read_u8(data, 6), + read_u8(data, 7)); + trace_vnc_msg_client_set_pixel_format_rgb(vs, vs->ioc, + read_u16(data, 8), + read_u16(data, 10), + read_u16(data, 12), + read_u8(data, 14), + read_u8(data, 15), + read_u8(data, 16)); set_pixel_format(vs, read_u8(data, 4), read_u8(data, 6), read_u8(data, 7), read_u16(data, 8), read_u16(data, 10), @@ -2410,12 +2440,19 @@ static int protocol_client_msg(VncState *vs, uint8_= t *data, size_t len) memcpy(data + 4 + (i * 4), &val, sizeof(val)); } =20 + trace_vnc_msg_client_set_encodings(vs, vs->ioc, limit); set_encodings(vs, (int32_t *)(data + 4), limit); break; case VNC_MSG_CLIENT_FRAMEBUFFER_UPDATE_REQUEST: if (len =3D=3D 1) return 10; =20 + trace_vnc_msg_client_framebuffer_update_request(vs, vs->ioc, + read_u8(data, 1), + read_u16(data, 2), + read_u16(data, 4), + read_u16(data, 6), + read_u16(data, 8)); framebuffer_update_request(vs, read_u8(data, 1), read_u16(data, 2), re= ad_u16(data, 4), read_u16(data, 6), read_u16(data, 8)); @@ -2424,12 +2461,19 @@ static int protocol_client_msg(VncState *vs, uint8_= t *data, size_t len) if (len =3D=3D 1) return 8; =20 + trace_vnc_msg_client_key_event(vs, vs->ioc, + read_u8(data, 1), + read_u32(data, 4)); key_event(vs, read_u8(data, 1), read_u32(data, 4)); break; case VNC_MSG_CLIENT_POINTER_EVENT: if (len =3D=3D 1) return 6; =20 + trace_vnc_msg_client_pointer_event(vs, vs->ioc, + read_u8(data, 1), + read_u16(data, 2), + read_u16(data, 4)); pointer_event(vs, read_u8(data, 1), read_u16(data, 2), read_u16(da= ta, 4)); break; case VNC_MSG_CLIENT_CUT_TEXT: @@ -2461,9 +2505,12 @@ static int protocol_client_msg(VncState *vs, uint8_t= *data, size_t len) vnc_client_error(vs); break; } + trace_vnc_msg_client_cut_text_ext(vs, vs->ioc, + dlen, read_u32(data, 8)); vnc_client_cut_text_ext(vs, dlen, read_u32(data, 8), data + 12= ); break; } + trace_vnc_msg_client_cut_text(vs, vs->ioc, read_u32(data, 4)); vnc_client_cut_text(vs, read_u32(data, 4), data + 8); break; case VNC_MSG_CLIENT_XVP: @@ -2478,6 +2525,7 @@ static int protocol_client_msg(VncState *vs, uint8_t = *data, size_t len) if (len =3D=3D 4) { uint8_t version =3D read_u8(data, 2); uint8_t action =3D read_u8(data, 3); + trace_vnc_msg_client_xvp(vs, vs->ioc, version, action); =20 if (version !=3D 1) { error_report("vnc: xvp client message version %d !=3D 1", @@ -2511,6 +2559,10 @@ static int protocol_client_msg(VncState *vs, uint8_t= *data, size_t len) if (len =3D=3D 2) return 12; =20 + trace_vnc_msg_client_ext_key_event(vs, vs->ioc, + read_u16(data, 2), + read_u32(data, 4), + read_u32(data, 8)); ext_key_event(vs, read_u16(data, 2), read_u32(data, 4), read_u32(data, 8)); break; --=20 2.49.0