From nobody Tue Oct 28 17:28:40 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=1760424235; cv=none; d=zohomail.com; s=zohoarc; b=nClcTqILWWdDlPiq6NsHnDpoJFsiJXjqIWCC09VjhmOuR+jeer4aM+G/vptSDDqahO2CBi2pgIxz7TbmnEeagNxqtHP5irBU/9kmjzKPH1S3Yc2Ee//t7UiHXjpYJFIiHhsVxeEqkYnpjvv4oTji6hWav4CuCZu6qjI+hranbsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760424235; 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=Ns5x0MXy/XGF2IIPnaoPNWQyg8AAFWzKlQg8heDSkc8=; b=MfJxiVaynmZsBQhZoHjm6yyOrj7mgl41YB8EvzCGE32BDn9znXCGX4tPvNrCgTuEtasoz0uIhiisjc/QNxllr9shm5jQMi0d56yyhUoBIS83S8nP0tgDqbmUvzE7u19quUudZfBsZ3QnIX64hdtpOGe5oyPq1J9QVcJZBluzIgY= 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 1760424235431739.1501967664066; Mon, 13 Oct 2025 23:43:55 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 7D7E8442B1; Tue, 14 Oct 2025 02:43:54 -0400 (EDT) Received: from [172.19.199.20] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 3007844830; Tue, 14 Oct 2025 02:37:46 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9318644252; Tue, 14 Oct 2025 02:32:05 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 084C641B73 for ; Tue, 14 Oct 2025 02:32:04 -0400 (EDT) Received: from mx-prod-mc-05.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-283-jCeZIsGWPEmWOgIRQ7ACng-1; Tue, 14 Oct 2025 02:32:02 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 849EF1956096 for ; Tue, 14 Oct 2025 06:32:01 +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 B0D5230002D0 for ; Tue, 14 Oct 2025 06:32:00 +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=1760423523; 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=Ns5x0MXy/XGF2IIPnaoPNWQyg8AAFWzKlQg8heDSkc8=; b=SYU6vv0A9F+tRN5ag0voxC5Uk82m0uMV1egZVXoTABc161a2ou+UYaz3+Edylz4uY/gSxb hPSWyh1yTc0sc3ZF9FqBF6iDB6P7RzmWAfCZ+XT8zrGpaQzMEK59hPGbqLYSwwZ7YmsQUX 2Xzgv2wTL/RPCcubR1M3WuUhct96eYs= X-MC-Unique: jCeZIsGWPEmWOgIRQ7ACng-1 X-Mimecast-MFC-AGG-ID: jCeZIsGWPEmWOgIRQ7ACng_1760423521 To: devel@lists.libvirt.org Subject: [PATCH 8/8] wireshark: Adapt to wireshark-4.6.0 Date: Tue, 14 Oct 2025 08:31:47 +0200 Message-ID: <8ed2f303d6a267202908656ec2b51965a788dc85.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: iL77AzOnVGJGtqJfql-d4W-4sV8RrHX0YK1lqa4ubT0_1760423521 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RW363HFT2VZUIBSKP7DBNY5ZFE5DUJJ3 X-Message-ID-Hash: RW363HFT2VZUIBSKP7DBNY5ZFE5DUJJ3 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: 1760424236125158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik The main difference is that wmem_packet_scope() is gone [1] but the packet_info struct has 'pool` member which points to the allocator used for given packet. Unfortunately, while we were given pointer to packet_info at the entry level to our dissector (dissect_libvirt() -> tcp_dissect_pdus() -> dissect_libvirt_message()) it was never propagated to generated/primitive dissectors. But not all dissectors need to allocate memory, so mark the new argument as unused. And while our generator could be rewritten so that the argument is annotated as unused iff it's really unused, I couldn't bother rewriting it. It's generated code after all. Too much work for little gain. Another significant change is that val_to_str() now requires new argument: pointer to allocator to use because it always allocates new memory [2][3]. 1: https://gitlab.com/wireshark/wireshark/-/commit/5ca5c9ca372e06881b23ba9f= 4fdcb6b479886444 2: https://gitlab.com/wireshark/wireshark/-/commit/b63599762468e4cf1783419a= 5556377604d344bb 3: https://gitlab.com/wireshark/wireshark/-/commit/84799be215313e61b83a3eaf= 074f89d6ee349b8c Resolves: https://gitlab.com/libvirt/libvirt/-/issues/823 Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- tools/wireshark/src/packet-libvirt.c | 157 +++++++++++++++++++-------- tools/wireshark/util/genxdrstub.pl | 18 +-- 2 files changed, 119 insertions(+), 56 deletions(-) diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/pac= ket-libvirt.c index 3178ac6f27..c5c8fb4756 100644 --- a/tools/wireshark/src/packet-libvirt.c +++ b/tools/wireshark/src/packet-libvirt.c @@ -63,7 +63,7 @@ static gint ett_libvirt_stream_hole =3D -1; =20 #define XDR_PRIMITIVE_DISSECTOR(xtype, ctype, ftype) \ static gboolean \ - dissect_xdr_##xtype(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf= ) \ + dissect_xdr_##xtype(tvbuff_t *tvb, packet_info *pinfo G_GNUC_UNUSED, p= roto_tree *tree, XDR *xdrs, int hf) \ { \ goffset start; \ ctype val; \ @@ -93,7 +93,7 @@ XDR_PRIMITIVE_DISSECTOR(bool, bool_t, boolean) =20 VIR_WARNINGS_RESET =20 -typedef gboolean (*vir_xdr_dissector_t)(tvbuff_t *tvb, proto_tree *tree, X= DR *xdrs, int hf); +typedef gboolean (*vir_xdr_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,= proto_tree *tree, XDR *xdrs, int hf); =20 typedef struct vir_dissector_index vir_dissector_index_t; struct vir_dissector_index { @@ -146,22 +146,32 @@ static const value_string status_strings[] =3D { }; =20 static char * -G_GNUC_PRINTF(3, 0) -vir_val_to_str(const uint32_t val, +G_GNUC_PRINTF(4, 0) +vir_val_to_str(packet_info *pinfo, + const uint32_t val, const value_string *vs, const char *fmt) { - return val_to_str_wmem(wmem_packet_scope(), val, vs, fmt); +#if WIRESHARK_VERSION < 4006000 + return val_to_str_wmem(pinfo->pool, val, vs, fmt); +#else + return val_to_str(pinfo->pool, val, vs, fmt); +#endif } =20 static void -vir_wmem_free(void *ptr) +vir_wmem_free(packet_info *pinfo, + void *ptr) { - wmem_free(wmem_packet_scope(), ptr); + wmem_free(pinfo->pool, ptr); } =20 static gboolean -dissect_xdr_string(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf, +dissect_xdr_string(tvbuff_t *tvb, + packet_info *pinfo G_GNUC_UNUSED, + proto_tree *tree, + XDR *xdrs, + int hf, guint32 maxlen) { goffset start; @@ -179,7 +189,11 @@ dissect_xdr_string(tvbuff_t *tvb, proto_tree *tree, XD= R *xdrs, int hf, } =20 static gboolean -dissect_xdr_opaque(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf, +dissect_xdr_opaque(tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + XDR *xdrs, + int hf, guint32 size) { goffset start; @@ -190,7 +204,7 @@ dissect_xdr_opaque(tvbuff_t *tvb, proto_tree *tree, XDR= *xdrs, int hf, start =3D xdr_getpos(xdrs); if ((rc =3D xdr_opaque(xdrs, (caddr_t)val, size))) { gint len =3D xdr_getpos(xdrs) - start; - const char *s =3D tvb_bytes_to_str(wmem_packet_scope(), tvb, start= , len); + const char *s =3D tvb_bytes_to_str(pinfo->pool, tvb, start, len); =20 proto_tree_add_bytes_format_value(tree, hf, tvb, start, len, NULL,= "%s", s); } else { @@ -202,7 +216,11 @@ dissect_xdr_opaque(tvbuff_t *tvb, proto_tree *tree, XD= R *xdrs, int hf, } =20 static gboolean -dissect_xdr_bytes(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf, +dissect_xdr_bytes(tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + XDR *xdrs, + int hf, guint32 maxlen) { goffset start; @@ -212,7 +230,7 @@ dissect_xdr_bytes(tvbuff_t *tvb, proto_tree *tree, XDR = *xdrs, int hf, start =3D xdr_getpos(xdrs); if (xdr_bytes(xdrs, (char **)&val, &length, maxlen)) { gint len =3D xdr_getpos(xdrs) - start; - const char *s =3D tvb_bytes_to_str(wmem_packet_scope(), tvb, start= , len); + const char *s =3D tvb_bytes_to_str(pinfo->pool, tvb, start, len); =20 proto_tree_add_bytes_format_value(tree, hf, tvb, start, len, NULL,= "%s", s); free(val); @@ -224,7 +242,11 @@ dissect_xdr_bytes(tvbuff_t *tvb, proto_tree *tree, XDR= *xdrs, int hf, } =20 static gboolean -dissect_xdr_pointer(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf, +dissect_xdr_pointer(tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + XDR *xdrs, + int hf, vir_xdr_dissector_t dissect) { goffset start; @@ -236,7 +258,7 @@ dissect_xdr_pointer(tvbuff_t *tvb, proto_tree *tree, XD= R *xdrs, int hf, return FALSE; } if (not_null) { - return dissect(tvb, tree, xdrs, hf); + return dissect(tvb, pinfo, tree, xdrs, hf); } else { proto_item *ti; ti =3D proto_tree_add_item(tree, hf, tvb, start, xdr_getpos(xdrs) = - start, ENC_NA); @@ -246,15 +268,22 @@ dissect_xdr_pointer(tvbuff_t *tvb, proto_tree *tree, = XDR *xdrs, int hf, } =20 static gboolean -dissect_xdr_iterable(tvbuff_t *tvb, proto_item *ti, XDR *xdrs, gint ett, i= nt rhf, - guint32 length, vir_xdr_dissector_t dissect, goffset = start) +dissect_xdr_iterable(tvbuff_t *tvb, + packet_info *pinfo, + proto_item *ti, + XDR *xdrs, + gint ett, + int rhf, + guint32 length, + vir_xdr_dissector_t dissect, + goffset start) { proto_tree *tree; guint32 i; =20 tree =3D proto_item_add_subtree(ti, ett); for (i =3D 0; i < length; i++) { - if (!dissect(tvb, tree, xdrs, rhf)) + if (!dissect(tvb, pinfo, tree, xdrs, rhf)) return FALSE; } proto_item_set_len(ti, xdr_getpos(xdrs) - start); @@ -262,8 +291,16 @@ dissect_xdr_iterable(tvbuff_t *tvb, proto_item *ti, XD= R *xdrs, gint ett, int rhf } =20 static gboolean -dissect_xdr_vector(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf, gin= t ett, - int rhf, const gchar *rtype, guint32 size, vir_xdr_diss= ector_t dissect) +dissect_xdr_vector(tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + XDR *xdrs, + int hf, + gint ett, + int rhf, + const gchar *rtype, + guint32 size, + vir_xdr_dissector_t dissect) { goffset start; proto_item *ti; @@ -271,12 +308,20 @@ dissect_xdr_vector(tvbuff_t *tvb, proto_tree *tree, X= DR *xdrs, int hf, gint ett, start =3D xdr_getpos(xdrs); ti =3D proto_tree_add_item(tree, hf, tvb, start, -1, ENC_NA); proto_item_append_text(ti, " :: %s[%u]", rtype, size); - return dissect_xdr_iterable(tvb, ti, xdrs, ett, rhf, size, dissect, st= art); + return dissect_xdr_iterable(tvb, pinfo, ti, xdrs, ett, rhf, size, diss= ect, start); } =20 static gboolean -dissect_xdr_array(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf, gint= ett, - int rhf, const gchar *rtype, guint32 maxlen, vir_xdr_dis= sector_t dissect) +dissect_xdr_array(tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + XDR *xdrs, + int hf, + gint ett, + int rhf, + const gchar *rtype, + guint32 maxlen, + vir_xdr_dissector_t dissect) { goffset start; proto_item *ti; @@ -291,7 +336,7 @@ dissect_xdr_array(tvbuff_t *tvb, proto_tree *tree, XDR = *xdrs, int hf, gint ett, =20 ti =3D proto_tree_add_item(tree, hf, tvb, start, -1, ENC_NA); proto_item_append_text(ti, " :: %s<%u>", rtype, length); - return dissect_xdr_iterable(tvb, ti, xdrs, ett, rhf, length, dissect, = start); + return dissect_xdr_iterable(tvb, pinfo, ti, xdrs, ett, rhf, length, di= ssect, start); } =20 static vir_xdr_dissector_t @@ -340,7 +385,10 @@ find_payload_dissector(int32_t proc, } =20 static void -dissect_libvirt_stream(tvbuff_t *tvb, proto_tree *tree, gint payload_lengt= h) +dissect_libvirt_stream(tvbuff_t *tvb, + packet_info *pinfo G_GNUC_UNUSED, + proto_tree *tree, + gint payload_length) { proto_tree_add_item(tree, hf_libvirt_stream, tvb, VIR_HEADER_LEN, payload_length - VIR_HEADER_LEN, ENC_NA); @@ -357,6 +405,7 @@ dissect_libvirt_num_of_fds(tvbuff_t *tvb, proto_tree *t= ree) =20 static void dissect_libvirt_fds(tvbuff_t *tvb G_GNUC_UNUSED, + packet_info *pinfo G_GNUC_UNUSED, gint start G_GNUC_UNUSED, gint32 nfds G_GNUC_UNUSED) { @@ -364,8 +413,12 @@ dissect_libvirt_fds(tvbuff_t *tvb G_GNUC_UNUSED, } =20 static void -dissect_libvirt_payload_xdr_data(tvbuff_t *tvb, proto_tree *tree, gint pay= load_length, - gint32 status, vir_xdr_dissector_t dissec= t) +dissect_libvirt_payload_xdr_data(tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + gint payload_length, + gint32 status, + vir_xdr_dissector_t dissect) { gint32 nfds =3D 0; gint start =3D VIR_HEADER_LEN; @@ -384,17 +437,21 @@ dissect_libvirt_payload_xdr_data(tvbuff_t *tvb, proto= _tree *tree, gint payload_l payload_data =3D (caddr_t)tvb_memdup(NULL, payload_tvb, 0, payload_len= gth); xdrmem_create(&xdrs, payload_data, payload_length, XDR_DECODE); =20 - dissect(payload_tvb, tree, &xdrs, -1); + dissect(payload_tvb, pinfo, tree, &xdrs, -1); =20 xdr_destroy(&xdrs); g_free(payload_data); =20 if (nfds !=3D 0) - dissect_libvirt_fds(tvb, start + payload_length, nfds); + dissect_libvirt_fds(tvb, pinfo, start + payload_length, nfds); } =20 static gboolean -dissect_xdr_stream_hole(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf) +dissect_xdr_stream_hole(tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + XDR *xdrs, + int hf) { goffset start; proto_item *ti; @@ -411,10 +468,10 @@ dissect_xdr_stream_hole(tvbuff_t *tvb, proto_tree *tr= ee, XDR *xdrs, int hf) tree =3D proto_item_add_subtree(ti, ett_libvirt_stream_hole); =20 hf =3D hf_libvirt_stream_hole_length; - if (!dissect_xdr_hyper(tvb, tree, xdrs, hf)) return FALSE; + if (!dissect_xdr_hyper(tvb, pinfo, tree, xdrs, hf)) return FALSE; =20 hf =3D hf_libvirt_stream_hole_flags; - if (!dissect_xdr_u_int(tvb, tree, xdrs, hf)) return FALSE; + if (!dissect_xdr_u_int(tvb, pinfo, tree, xdrs, hf)) return FALSE; =20 proto_item_set_len(ti, xdr_getpos(xdrs) - start); return TRUE; @@ -424,6 +481,7 @@ dissect_xdr_stream_hole(tvbuff_t *tvb, proto_tree *tree= , XDR *xdrs, int hf) =20 static void dissect_libvirt_payload(tvbuff_t *tvb, + packet_info *pinfo, proto_tree *tree, uint32_t prog, int32_t proc, @@ -447,13 +505,13 @@ dissect_libvirt_payload(tvbuff_t *tvb, xd =3D find_payload_dissector(proc, type, pds, *len); if (xd =3D=3D NULL) goto unknown; - dissect_libvirt_payload_xdr_data(tvb, tree, payload_length, status= , xd); + dissect_libvirt_payload_xdr_data(tvb, pinfo, tree, payload_length,= status, xd); } else if (status =3D=3D VIR_NET_ERROR) { - dissect_libvirt_payload_xdr_data(tvb, tree, payload_length, status= , dissect_xdr_remote_error); + dissect_libvirt_payload_xdr_data(tvb, pinfo, tree, payload_length,= status, dissect_xdr_remote_error); } else if (type =3D=3D VIR_NET_STREAM) { /* implicitly, status =3D=3D = VIR_NET_CONTINUE */ - dissect_libvirt_stream(tvb, tree, payload_length); + dissect_libvirt_stream(tvb, pinfo, tree, payload_length); } else if (type =3D=3D VIR_NET_STREAM_HOLE) { - dissect_libvirt_payload_xdr_data(tvb, tree, payload_length, status= , dissect_xdr_stream_hole); + dissect_libvirt_payload_xdr_data(tvb, pinfo, tree, payload_length,= status, dissect_xdr_stream_hole); } else { goto unknown; } @@ -489,21 +547,21 @@ dissect_libvirt_message(tvbuff_t *tvb, packet_info *p= info, proto_tree *tree, serial =3D tvb_get_ntohl(tvb, offset); offset +=3D 4; status =3D tvb_get_ntohil(tvb, offset); offset +=3D 4; =20 - prog_str =3D vir_val_to_str(prog, program_strings, "%x"); + prog_str =3D vir_val_to_str(pinfo, prog, program_strings, "%x"); col_add_fstr(pinfo->cinfo, COL_INFO, "Prog=3D%s", prog_str); - vir_wmem_free(prog_str); + vir_wmem_free(pinfo, prog_str); =20 vs =3D get_program_data(prog, VIR_PROGRAM_PROCSTRINGS); - proc_str =3D vir_val_to_str(proc, vs, "%d"); + proc_str =3D vir_val_to_str(pinfo, proc, vs, "%d"); col_append_fstr(pinfo->cinfo, COL_INFO, " Proc=3D%s", proc_str); - vir_wmem_free(proc_str); + vir_wmem_free(pinfo, proc_str); =20 - type_str =3D vir_val_to_str(type, type_strings, "%d"); - status_str =3D vir_val_to_str(status, status_strings, "%d"); + type_str =3D vir_val_to_str(pinfo, type, type_strings, "%d"); + status_str =3D vir_val_to_str(pinfo, status, status_strings, "%d"); col_append_fstr(pinfo->cinfo, COL_INFO, " Type=3D%s Serial=3D%u Status= =3D%s", type_str, serial, status_str); - vir_wmem_free(status_str); - vir_wmem_free(type_str); + vir_wmem_free(pinfo, status_str); + vir_wmem_free(pinfo, type_str); =20 if (tree) { gint *hf_proc; @@ -532,21 +590,26 @@ dissect_libvirt_message(tvbuff_t *tvb, packet_info *p= info, proto_tree *tree, proto_tree_add_item(libvirt_tree, hf_libvirt_status, tvb, offset,= 4, ENC_NA); offset +=3D 4; =20 /* Dissect payload remaining */ - dissect_libvirt_payload(tvb, libvirt_tree, prog, proc, type, statu= s); + dissect_libvirt_payload(tvb, pinfo, libvirt_tree, prog, proc, type= , status); } =20 return 0; } =20 static guint -get_message_len(packet_info *pinfo G_GNUC_UNUSED, tvbuff_t *tvb, int offse= t, void *data G_GNUC_UNUSED) +get_message_len(packet_info *pinfo G_GNUC_UNUSED, + tvbuff_t *tvb, + int offset, + void *data G_GNUC_UNUSED) { return tvb_get_ntohl(tvb, offset); } =20 static int -dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, void *data G_GNUC_UNUSED) +dissect_libvirt(tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + void *data G_GNUC_UNUSED) { /* Another magic const - 4; simply, how much bytes * is needed to tell the length of libvirt packet. */ diff --git a/tools/wireshark/util/genxdrstub.pl b/tools/wireshark/util/genx= drstub.pl index 01b663a88c..f69695c091 100755 --- a/tools/wireshark/util/genxdrstub.pl +++ b/tools/wireshark/util/genxdrstub.pl @@ -250,7 +250,7 @@ sub xdr_type { sub render_caller { my ($self, $hfid) =3D @_; my $name =3D $c->rinc( 'dissect_xdr_'.($self->idstrip || lc($self->xdr= _type)) ); - "$name(tvb, tree, xdrs, hf)"; + "$name(tvb, pinfo, tree, xdrs, hf)"; } =20 sub ft_type { @@ -345,7 +345,7 @@ BEGIN{::register_profile( sub render_caller { my ($self) =3D @_; my ($klass) =3D ref($self) =3D~ /([^:]+)$/; - sprintf '%s(tvb, tree, xdrs, hf, %s)', + sprintf '%s(tvb, pinfo, tree, xdrs, hf, %s)', $c->rinc('dissect_xdr_'.lc($klass)), $c->rinc('dissect_xdr_'.$self->reftype->idstrip); } @@ -359,7 +359,7 @@ BEGIN{::register_profile( sub render_caller { my ($self, $hfid) =3D @_; my ($klass) =3D ref($self) =3D~ /([^:]+)$/; - sprintf '%s(tvb, tree, xdrs, hf, %s)', + sprintf '%s(tvb, pinfo, tree, xdrs, hf, %s)', $c->rinc('dissect_xdr_'.lc($klass)), $self->length || '~0'; } =20 @@ -447,7 +447,7 @@ BEGIN{::register_profile( sub render_caller { my ($self, $hfid) =3D @_; my ($pname) =3D reverse split /__/, $hfid; - sprintf 'dissect_xdr_array(tvb, tree, xdrs, hf, %s, %s, "%s", %s, %s)', + sprintf 'dissect_xdr_array(tvb, pinfo, tree, xdrs, hf, %s, %s, "%s", %= s, %s)', $c->rinc('ett_'.$self->idstrip), $c->rinc("hf_$hfid\__$pname"), $self->reftype->idstrip, @@ -476,7 +476,7 @@ BEGIN{::register_profile( sub render_caller { my ($self, $hfid) =3D @_; my ($pname) =3D reverse split /__/, $hfid; - sprintf 'dissect_xdr_vector(tvb, tree, xdrs, hf, %s, %s, "%s", %s, %s)= ', + sprintf 'dissect_xdr_vector(tvb, pinfo, tree, xdrs, hf, %s, %s, "%s", = %s, %s)', $c->rinc('ett_'.$self->idstrip), $c->rinc("hf_$hfid\__$pname"), $self->reftype->idstrip, @@ -857,7 +857,7 @@ __END__<is_primitive; %> -static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *tvb, proto_tree *tre= e, XDR *xdrs, int hf) +static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *tvb, packet_info *pi= nfo G_GNUC_UNUSED, proto_tree *tree, XDR *xdrs, int hf) { return <%=3D $self->dealias->render_caller($self->ident eq $ident ? un= def : $ident) %>; } @@ -865,7 +865,7 @@ static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *t= vb, proto_tree *tree, XDR * <% my ($self, $ident) =3D @_; my $hfvar =3D $c->rinc('hf_'.$self->idstrip); %> -static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *tvb, proto_tree *tre= e, XDR *xdrs, int hf) +static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *tvb, packet_info *pi= nfo G_GNUC_UNUSED, proto_tree *tree, XDR *xdrs, int hf) { goffset start; proto_item *ti; @@ -890,7 +890,7 @@ static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *t= vb, proto_tree *tree, XDR * } @@ Sym::Type::Enum#render_dissector <% my ($self, $ident) =3D @_; %> -static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *tvb, proto_tree *tre= e, XDR *xdrs, int hf) +static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *tvb, packet_info *pi= nfo G_GNUC_UNUSED, proto_tree *tree, XDR *xdrs, int hf) { goffset start; enum { DUMMY } es; @@ -914,7 +914,7 @@ static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *t= vb, proto_tree *tree, XDR * my ($self, $ident) =3D @_; my $decl_type =3D $self->decl->type->idstrip; %> -static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *tvb, proto_tree *tre= e, XDR *xdrs, int hf) +static gboolean dissect_xdr_<%=3D $ident %>(tvbuff_t *tvb, packet_info *pi= nfo G_GNUC_UNUSED, proto_tree *tree, XDR *xdrs, int hf) { gboolean rc =3D TRUE; goffset start; --=20 2.49.1