From nobody Wed Dec 17 06:12:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549625478790329.87262934326645; Fri, 8 Feb 2019 03:31:18 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 07D3381DFA; Fri, 8 Feb 2019 11:31:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FA2B60123; Fri, 8 Feb 2019 11:31:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0B7413F603; Fri, 8 Feb 2019 11:31:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x18BTph3027953 for ; Fri, 8 Feb 2019 06:29:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 20AA41796F; Fri, 8 Feb 2019 11:29:51 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B1716090D for ; Fri, 8 Feb 2019 11:29:50 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 8 Feb 2019 12:23:28 +0100 Message-Id: <8ee34398487a705a2eef6392f084ce89c2cb2f2e.1549624935.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] tools: Drop support for pre-2.4.0 wireshark X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 08 Feb 2019 11:31:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The wireshark-2.4.0 is almost 2 years old now. Assuming anybody interested in running latest libvirt doesn't run old wireshark, it is safe to do this. It also simplifies the code. Signed-off-by: Michal Privoznik --- libvirt.spec.in | 8 ++---- m4/virt-wireshark.m4 | 4 +-- tools/wireshark/src/packet-libvirt.c | 39 ---------------------------- tools/wireshark/src/plugin.c | 14 +++------- 4 files changed, 7 insertions(+), 58 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 13f41bb4a5..9beffba203 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -166,11 +166,7 @@ # Enable wireshark plugins for all distros shipping libvirt 1.2.2 or newer %if 0%{?fedora} %define with_wireshark 0%{!?_without_wireshark:1} -%endif -%if 0%{?fedora} || 0%{?rhel} > 7 %define wireshark_plugindir %(pkg-config --variable plugindir wireshar= k)/epan -%else - %define wireshark_plugindir %{_libdir}/wireshark/plugins/epan %endif =20 # Enable libssh transport for new enough distros @@ -389,7 +385,7 @@ BuildRequires: numad %endif =20 %if %{with_wireshark} -BuildRequires: wireshark-devel >=3D 2.1.0 +BuildRequires: wireshark-devel >=3D 2.4.0 %endif =20 %if %{with_libssh} @@ -935,7 +931,7 @@ Bash completion script stub. %if %{with_wireshark} %package wireshark Summary: Wireshark dissector plugin for libvirt RPC transactions -Requires: wireshark >=3D 1.12.6-4 +Requires: wireshark >=3D 2.4.0 Requires: %{name}-libs =3D %{version}-%{release} =20 %description wireshark diff --git a/m4/virt-wireshark.m4 b/m4/virt-wireshark.m4 index a8f8083f5e..2fbf691590 100644 --- a/m4/virt-wireshark.m4 +++ b/m4/virt-wireshark.m4 @@ -18,14 +18,14 @@ dnl . dnl =20 AC_DEFUN([LIBVIRT_ARG_WIRESHARK],[ - LIBVIRT_ARG_WITH_FEATURE([WIRESHARK_DISSECTOR], [wireshark], [check], [1= .11.3]) + LIBVIRT_ARG_WITH_FEATURE([WIRESHARK_DISSECTOR], [wireshark], [check], [2= .4.0]) LIBVIRT_ARG_WITH([WS_PLUGINDIR], [wireshark plugins directory for use when installing wireshark plugin], [check]) ]) =20 AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[ - LIBVIRT_CHECK_PKG([WIRESHARK_DISSECTOR], [wireshark], [1.11.3]) + LIBVIRT_CHECK_PKG([WIRESHARK_DISSECTOR], [wireshark], [2.4.0]) =20 dnl Check for system location of wireshark plugins if test "x$with_wireshark_dissector" !=3D "xno" ; then diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/pac= ket-libvirt.c index e759e81bae..dc3aa410e5 100644 --- a/tools/wireshark/src/packet-libvirt.c +++ b/tools/wireshark/src/packet-libvirt.c @@ -42,12 +42,6 @@ # define dbg(fmt, ...) #endif =20 -/* Wireshark 1.12 brings API change */ -#define WIRESHARK_VERSION \ - ((VERSION_MAJOR * 1000 * 1000) + \ - (VERSION_MINOR * 1000) + \ - (VERSION_MICRO)) - static int proto_libvirt =3D -1; static int hf_libvirt_length =3D -1; static int hf_libvirt_program =3D -1; @@ -373,17 +367,8 @@ dissect_libvirt_payload_xdr_data(tvbuff_t *tvb, proto_= tree *tree, gint payload_l payload_length -=3D 4; } =20 -#if WIRESHARK_VERSION < 200400 - payload_tvb =3D tvb_new_subset(tvb, start, -1, payload_length); -#else payload_tvb =3D tvb_new_subset_remaining(tvb, start); -#endif - -#if WIRESHARK_VERSION < 1012000 - payload_data =3D (caddr_t)tvb_memdup(payload_tvb, 0, payload_length); -#else payload_data =3D (caddr_t)tvb_memdup(NULL, payload_tvb, 0, payload_len= gth); -#endif xdrmem_create(&xdrs, payload_data, payload_length, XDR_DECODE); =20 dissect(payload_tvb, tree, &xdrs, -1); @@ -456,14 +441,9 @@ dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tre= e, proto_tree_add_item(tree, hf_libvirt_unknown, tvb, VIR_HEADER_LEN, -1,= ENC_NA); } =20 -#if WIRESHARK_VERSION < 1012000 -static void -dissect_libvirt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre= e) -#else static int dissect_libvirt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre= e, void *opaque ATTRIBUTE_UNUSED) -#endif { goffset offset; guint32 prog, proc, type, serial, status; @@ -524,44 +504,25 @@ dissect_libvirt_message(tvbuff_t *tvb, packet_info *p= info, proto_tree *tree, dissect_libvirt_payload(tvb, libvirt_tree, prog, proc, type, statu= s); } =20 -#if WIRESHARK_VERSION >=3D 1012000 return 0; -#endif } =20 -#if WIRESHARK_VERSION >=3D 1099002 static guint get_message_len(packet_info *pinfo ATTRIBUTE_UNUSED, tvbuff_t *tvb, int of= fset, void *data ATTRIBUTE_UNUSED) -#else -static guint32 -get_message_len(packet_info *pinfo ATTRIBUTE_UNUSED, tvbuff_t *tvb, int of= fset) -#endif { return tvb_get_ntohl(tvb, offset); } =20 -#if WIRESHARK_VERSION >=3D 2000001 static int dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data ATTRIBUTE_UNUSED) -#else -static void -dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -#endif { /* Another magic const - 4; simply, how much bytes * is needed to tell the length of libvirt packet. */ -#if WIRESHARK_VERSION < 1012000 - tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, - get_message_len, dissect_libvirt_message); -#else tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, get_message_len, dissect_libvirt_message, NULL); -#endif =20 -#if WIRESHARK_VERSION >=3D 2000001 return tvb_captured_length(tvb); -#endif } =20 void diff --git a/tools/wireshark/src/plugin.c b/tools/wireshark/src/plugin.c index 3741334e85..504e4383a7 100644 --- a/tools/wireshark/src/plugin.c +++ b/tools/wireshark/src/plugin.c @@ -31,29 +31,21 @@ (VERSION_MICRO)) =20 #if WIRESHARK_VERSION < 2005000 -/* In 1.12 wireshark WS_DLL_PUBLIC_NOEXTERN was substitued with - * WS_DLL_PUBLIC_DEF. See wireshark's commit - * 5d87a8c46171f572568db5a47c093423482e342f for more info. */ -# ifndef WS_DLL_PUBLIC_NOEXTERN -# define WS_DLL_PUBLIC_NOEXTERN WS_DLL_PUBLIC_DEF -# endif =20 -# ifndef ENABLE_STATIC -WS_DLL_PUBLIC_NOEXTERN const gchar version[] =3D VERSION; +WS_DLL_PUBLIC_DEF const gchar version[] =3D VERSION; =20 /* Start the functions we need for the plugin stuff */ =20 -WS_DLL_PUBLIC_NOEXTERN void +WS_DLL_PUBLIC_DEF void plugin_register(void) { proto_register_libvirt(); } -WS_DLL_PUBLIC_NOEXTERN void +WS_DLL_PUBLIC_DEF void plugin_reg_handoff(void) { proto_reg_handoff_libvirt(); } -# endif =20 #elif WIRESHARK_VERSION < 2009000 =20 --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list