mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
wireshark: Prefer ws_version.h over config.h
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 <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
ec46e6d44b
commit
caa9560c15
@ -1472,6 +1472,12 @@ if wireshark_dep.found()
|
||||
# Since wireshark 2.5.0 plugins can't live in top level plugindir but have
|
||||
# to be under one of ["epan", "wiretap", "codecs"] subdir. The first one looks okay.
|
||||
wireshark_plugindir = wireshark_plugindir / 'epan'
|
||||
|
||||
# Wireshark is installing ws_version.h since v2.9.0, but some distributions
|
||||
# are not shipping it.
|
||||
if cc.has_header('wireshark/ws_version.h')
|
||||
conf.set('WITH_WS_VERSION', 1)
|
||||
endif
|
||||
endif
|
||||
|
||||
# On MinGW portablexdr provides XDR functions, on linux they are
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#include <wireshark/config.h>
|
||||
#include <wireshark/epan/proto.h>
|
||||
#include <wireshark/epan/packet.h>
|
||||
#include <wireshark/epan/dissectors/packet-tcp.h>
|
||||
|
@ -14,7 +14,16 @@
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
#include <wireshark/config.h>
|
||||
#ifdef WITH_WS_VERSION
|
||||
# include <wireshark/ws_version.h>
|
||||
#else
|
||||
# include <wireshark/config.h>
|
||||
# define WIRESHARK_VERSION_MAJOR VERSION_MAJOR
|
||||
# define WIRESHARK_VERSION_MINOR VERSION_MINOR
|
||||
# define WIRESHARK_VERSION_MICRO VERSION_MICRO
|
||||
#endif
|
||||
|
||||
#define HAVE_PLUGINS 1
|
||||
#include <wireshark/epan/proto.h>
|
||||
/* plugins are DLLs */
|
||||
#define WS_BUILD_DLL
|
||||
@ -26,9 +35,9 @@
|
||||
#define PLUGIN_VERSION VERSION
|
||||
|
||||
#define WIRESHARK_VERSION \
|
||||
((VERSION_MAJOR * 1000 * 1000) + \
|
||||
(VERSION_MINOR * 1000) + \
|
||||
(VERSION_MICRO))
|
||||
((WIRESHARK_VERSION_MAJOR * 1000 * 1000) + \
|
||||
(WIRESHARK_VERSION_MINOR * 1000) + \
|
||||
(WIRESHARK_VERSION_MICRO))
|
||||
|
||||
#if WIRESHARK_VERSION < 2005000
|
||||
|
||||
@ -69,8 +78,8 @@ void proto_register_libvirt(void);
|
||||
void proto_reg_handoff_libvirt(void);
|
||||
|
||||
WS_DLL_PUBLIC_DEF const gchar plugin_version[] = PLUGIN_VERSION;
|
||||
WS_DLL_PUBLIC_DEF const int plugin_want_major = VERSION_MAJOR;
|
||||
WS_DLL_PUBLIC_DEF const int plugin_want_minor = VERSION_MINOR;
|
||||
WS_DLL_PUBLIC_DEF const int plugin_want_major = WIRESHARK_VERSION_MAJOR;
|
||||
WS_DLL_PUBLIC_DEF const int plugin_want_minor = WIRESHARK_VERSION_MINOR;
|
||||
|
||||
WS_DLL_PUBLIC void plugin_register(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user