From nobody Tue Oct 28 17:33:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1760423945; cv=none; d=zohomail.com; s=zohoarc; b=ZvORJfuY94NCsUz8UceAQvwvPKQ2WBheU5vwumCttysX5KbUKX33EtvDE5Q4UOUXDH5ZNCSv/0Qh+H2rI2MB9BhejQrYQ9x4yWUs2YFjd2PxGJHsMDxW7V1LnRtbTqZ23saCQ15A7hYBFLuq4KuvltcR4KaK4BtYJLNkU3n69AE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760423945; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=oBInzYJbd/NMOeclCs5/cqprUi6yczsPijFD7k/lsW0=; b=YN0eL3tIy3YLva4PJh1CLwIxFgX2FY9vwt6RBuDcfTHdl5HptFxi8u+3VFqyE87xZJXbuqF5w0u7G/TOMjMbP2ilSMjOGj5LYpvSzo7X9IeQYweSUApxn5a2Oc2HTxTppxEB1iFtz4l373ziv1PkAFO3LGWpsUW9zYcG027eigc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1760423945336973.8455976941228; Mon, 13 Oct 2025 23:39:05 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B63AF4435D; Tue, 14 Oct 2025 02:39:04 -0400 (EDT) Received: from [172.19.199.20] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id B6F884441F; Tue, 14 Oct 2025 02:37:24 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8FB8641B73; Tue, 14 Oct 2025 02:32:00 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CC25844252 for ; Tue, 14 Oct 2025 02:31:59 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-358-86W7awcdPaWuqBk7Yyd2ow-1; Tue, 14 Oct 2025 02:31:58 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4BB8E195608D for ; Tue, 14 Oct 2025 06:31:57 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.3.236]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A835D300018D for ; Tue, 14 Oct 2025 06:31:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760423519; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oBInzYJbd/NMOeclCs5/cqprUi6yczsPijFD7k/lsW0=; b=E9fkaPul3z9jZt1SPpQlW3gqQuh8nKqPXixb8OHlR7w2g3HfhYNqOqZmIJ5Dn+FVDkeUBK RdZ+0EtIq2Gza5gUgLDD8XxE0vvbNW9grPxLpyHtOxcI25NNBdHcoo6HkUulN/6HZAqU1I AcX6FbVPxez6csxGAW9J9Y0NLnDajLc= X-MC-Unique: 86W7awcdPaWuqBk7Yyd2ow-1 X-Mimecast-MFC-AGG-ID: 86W7awcdPaWuqBk7Yyd2ow_1760423517 To: devel@lists.libvirt.org Subject: [PATCH 4/8] wireshark: Fix int type of some virNetMessageHeader members Date: Tue, 14 Oct 2025 08:31:43 +0200 Message-ID: <7e2026668a639c39d4be2ad2b939c995de5ac150.1760423277.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: _w3Pg3mOEb6xCxEiFFs_8XdeociMQDMIz6lHNM92tpw_1760423517 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6O4GBPUPJWYG4RZDHZC5WUXIBGQR3DZE X-Message-ID-Hash: 6O4GBPUPJWYG4RZDHZC5WUXIBGQR3DZE X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1760423947232154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Our virNetMessageHeader is a struct that's declared as follows: struct virNetMessageHeader { unsigned prog; unsigned vers; int proc; virNetMessageType type; unsigned serial; virNetMessageStatus status; }; Now, per RFC 4506 enums are also encoded as signed integers. This means, that only 'prog', 'vers' and 'serial' are really unsigned integers. The others ('proc', 'type' and 'status') are encoded as signed integers. Fix their type when dissecting. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- tools/wireshark/src/packet-libvirt.c | 34 +++++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/pac= ket-libvirt.c index da2aabd98a..af14c6bed7 100644 --- a/tools/wireshark/src/packet-libvirt.c +++ b/tools/wireshark/src/packet-libvirt.c @@ -92,7 +92,7 @@ typedef gboolean (*vir_xdr_dissector_t)(tvbuff_t *tvb, pr= oto_tree *tree, XDR *xd =20 typedef struct vir_dissector_index vir_dissector_index_t; struct vir_dissector_index { - guint32 proc; + int32_t proc; vir_xdr_dissector_t args; vir_xdr_dissector_t ret; vir_xdr_dissector_t msg; @@ -275,8 +275,10 @@ dissect_xdr_array(tvbuff_t *tvb, proto_tree *tree, XDR= *xdrs, int hf, gint ett, } =20 static vir_xdr_dissector_t -find_payload_dissector(guint32 proc, guint32 type, - const vir_dissector_index_t *pds, gsize length) +find_payload_dissector(int32_t proc, + enum vir_net_message_type type, + const vir_dissector_index_t *pds, + gsize length) { const vir_dissector_index_t *pd; guint32 first, last, direction; @@ -309,6 +311,10 @@ find_payload_dissector(guint32 proc, guint32 type, return pd->ret; case VIR_NET_MESSAGE: return pd->msg; + case VIR_NET_STREAM: + case VIR_NET_STREAM_HOLE: + /* Handled elsewhere */ + return NULL; } return NULL; } @@ -397,8 +403,12 @@ dissect_xdr_stream_hole(tvbuff_t *tvb, proto_tree *tre= e, XDR *xdrs, int hf) #include "libvirt/protocol.h" =20 static void -dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tree, - guint32 prog, guint32 proc, guint32 type, guint32 = status) +dissect_libvirt_payload(tvbuff_t *tvb, + proto_tree *tree, + uint32_t prog, + int32_t proc, + int32_t type, + int32_t status) { gssize payload_length; =20 @@ -430,7 +440,8 @@ dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tree, return; =20 unknown: - dbg("Cannot determine payload: Prog=3D%u, Proc=3D%u, Type=3D%u, Status= =3D%u", prog, proc, type, status); + dbg("Cannot determine payload: Prog=3D%u, Proc=3D%d, Type=3D%d, Status= =3D%d", + prog, proc, type, status); proto_tree_add_item(tree, hf_libvirt_unknown, tvb, VIR_HEADER_LEN, -1,= ENC_NA); } =20 @@ -439,7 +450,8 @@ dissect_libvirt_message(tvbuff_t *tvb, packet_info *pin= fo, proto_tree *tree, void *opaque G_GNUC_UNUSED) { goffset offset; - guint32 prog, proc, type, serial, status; + uint32_t prog, serial; + int32_t proc, type, status; const value_string *vs; =20 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Libvirt"); @@ -448,17 +460,17 @@ dissect_libvirt_message(tvbuff_t *tvb, packet_info *p= info, proto_tree *tree, offset =3D 4; /* End of length field */ prog =3D tvb_get_ntohl(tvb, offset); offset +=3D 4; offset +=3D 4; /* Ignore version header field */ - proc =3D tvb_get_ntohl(tvb, offset); offset +=3D 4; - type =3D tvb_get_ntohl(tvb, offset); offset +=3D 4; + proc =3D tvb_get_ntohil(tvb, offset); offset +=3D 4; + type =3D tvb_get_ntohil(tvb, offset); offset +=3D 4; serial =3D tvb_get_ntohl(tvb, offset); offset +=3D 4; - status =3D tvb_get_ntohl(tvb, offset); offset +=3D 4; + status =3D tvb_get_ntohil(tvb, offset); offset +=3D 4; =20 col_add_fstr(pinfo->cinfo, COL_INFO, "Prog=3D%s", val_to_str(prog, program_strings, "%x")); =20 vs =3D get_program_data(prog, VIR_PROGRAM_PROCSTRINGS); if (vs =3D=3D NULL) { - col_append_fstr(pinfo->cinfo, COL_INFO, " Proc=3D%u", proc); + col_append_fstr(pinfo->cinfo, COL_INFO, " Proc=3D%d", proc); } else { col_append_fstr(pinfo->cinfo, COL_INFO, " Proc=3D%s", val_to_str(p= roc, vs, "%d")); } --=20 2.49.1