From nobody Wed May 8 16:59:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599503430; cv=none; d=zohomail.com; s=zohoarc; b=NppbzzLSzr8B1bxVxE0KBUzt4w7pPqTFQALgzQq7Igd0KmZXBb3GLplTgljls4QRiHDtneBGV879g8lX7KTSszaWlr6aNs6WKjG3I9kBITXBeeN7UIq6c9NEoqSi/M4jxpTU/iC6rIb5xtS8cUvjPrDQxs4Wvtpd3RQoWRfdd9I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599503430; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=oxMtfCq0SYY7vdE9a2OWVJHyivpgjeDTPHiLNA5AQg0=; b=lhpgOV8MB5E7RPYJfJQlSWMCByRjdaqsxT66a5wW0pwl4Kra0NR1US2oD+3G7cg1On4Bj4E95O8opy/7ibgHy4mWT3+SwiwTYbQbdkZKrYyRmJeVuBIs5rjWnJlUt1Qv1Lwpf+HvOcYuY1aqVgXDSRv0cNpiAeQt+N50sBqyYIA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 159950343097396.33036163730196; Mon, 7 Sep 2020 11:30:30 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-558-1zl3J41ZMnKV7VnXpzgjoQ-1; Mon, 07 Sep 2020 14:30:27 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E98D1084C85; Mon, 7 Sep 2020 18:30:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E5B15D9DD; Mon, 7 Sep 2020 18:30:19 +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 CBCEB181A06B; Mon, 7 Sep 2020 18:30:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087IUD8W020339 for ; Mon, 7 Sep 2020 14:30:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id AB0535D9E2; Mon, 7 Sep 2020 18:30:13 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B9DD5D9DD for ; Mon, 7 Sep 2020 18:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599503429; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=oxMtfCq0SYY7vdE9a2OWVJHyivpgjeDTPHiLNA5AQg0=; b=EfeDZeR3M3Gs4qRza3ZtkhS71+kQyldAC2rpnePHzi8zPTe82kmHbdR7Z3csII4VX4SbMT 0AQsoHjnBMAafiw7j7TVSmga00/92QkdLMP3G/21vchXYOHyYFqfMMDsDwy3sSOZOQX7w6 M5LKOauZUtD1PFtlUjHKGpjttVZZm7E= X-MC-Unique: 1zl3J41ZMnKV7VnXpzgjoQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] wireshark: Prefer ws_version.h over config.h Date: Mon, 7 Sep 2020 20:30:08 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" A wireshark plugin must declare what major and minor version it was built with as these are checked when wireshark loads plugins. On the top of that, we use major + minor + micro to adapt to changed API between releases. So far, we were getting these version numbers from wireshark/config.h. And while most distributions install wireshark/config.h file some don't. On distros shipping it it's hack^Wsaved during built by packaging system and installed later. But some distros are not doing that. At least not for new enough wireshark because as of wireshark's commit v2.9.0~1273 the ws_version.h is installed which contains the version macros we need and is installed by wireshark itself. But of course, some distros which have new enough wireshark packaged do not ship ws_version.h and stick to the hack. That is why we can't simply bump the minimal version and switch to the new header file. We need a configure check and adopt our code to deal with both ways. At least for the time being. Based on Andrea's original patch: https://www.redhat.com/archives/libvir-list/2020-September/msg00156.html Closes: https://gitlab.com/libvirt/libvirt/-/issues/74 Signed-off-by: Michal Privoznik Reviewed-by: Andrea Bolognani Reviewed-by: Martin Kletzander --- meson.build | 6 ++++++ tools/wireshark/src/packet-libvirt.c | 1 - tools/wireshark/src/plugin.c | 21 +++++++++++++++------ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 1eadea33bf..33eaa9ff56 100644 --- a/meson.build +++ b/meson.build @@ -1472,6 +1472,12 @@ if wireshark_dep.found() # Since wireshark 2.5.0 plugins can't live in top level plugindir but ha= ve # to be under one of ["epan", "wiretap", "codecs"] subdir. The first one= looks okay. wireshark_plugindir =3D wireshark_plugindir / 'epan' + + # Wireshark is installing ws_version.h since v2.9.0, but some distributi= ons + # are not shipping it. + if cc.has_header('wireshark/ws_version.h') + conf.set('WITH_WS_VERSION', 1) + endif endif =20 # On MinGW portablexdr provides XDR functions, on linux they are diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/pac= ket-libvirt.c index 9f3c7f650d..965f1f5482 100644 --- a/tools/wireshark/src/packet-libvirt.c +++ b/tools/wireshark/src/packet-libvirt.c @@ -18,7 +18,6 @@ */ #include =20 -#include #include #include #include diff --git a/tools/wireshark/src/plugin.c b/tools/wireshark/src/plugin.c index 504e4383a7..13af1b6a73 100644 --- a/tools/wireshark/src/plugin.c +++ b/tools/wireshark/src/plugin.c @@ -14,7 +14,16 @@ =20 #include =20 -#include +#ifdef WITH_WS_VERSION +# include +#else +# include +# define WIRESHARK_VERSION_MAJOR VERSION_MAJOR +# define WIRESHARK_VERSION_MINOR VERSION_MINOR +# define WIRESHARK_VERSION_MICRO VERSION_MICRO +#endif + +#define HAVE_PLUGINS 1 #include /* plugins are DLLs */ #define WS_BUILD_DLL @@ -26,9 +35,9 @@ #define PLUGIN_VERSION VERSION =20 #define WIRESHARK_VERSION \ - ((VERSION_MAJOR * 1000 * 1000) + \ - (VERSION_MINOR * 1000) + \ - (VERSION_MICRO)) + ((WIRESHARK_VERSION_MAJOR * 1000 * 1000) + \ + (WIRESHARK_VERSION_MINOR * 1000) + \ + (WIRESHARK_VERSION_MICRO)) =20 #if WIRESHARK_VERSION < 2005000 =20 @@ -69,8 +78,8 @@ void proto_register_libvirt(void); void proto_reg_handoff_libvirt(void); =20 WS_DLL_PUBLIC_DEF const gchar plugin_version[] =3D PLUGIN_VERSION; -WS_DLL_PUBLIC_DEF const int plugin_want_major =3D VERSION_MAJOR; -WS_DLL_PUBLIC_DEF const int plugin_want_minor =3D VERSION_MINOR; +WS_DLL_PUBLIC_DEF const int plugin_want_major =3D WIRESHARK_VERSION_MAJOR; +WS_DLL_PUBLIC_DEF const int plugin_want_minor =3D WIRESHARK_VERSION_MINOR; =20 WS_DLL_PUBLIC void plugin_register(void); =20 --=20 2.26.2