From 052912b4251059f71ffa55c3ed7e6737bcec3abf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Tue, 19 Jan 2021 14:33:24 +0100 Subject: [PATCH] MINOR: contrib: Make the wireshark peers dissector compile for more distribs. With a 2.6.8 wireshark, this module could not compile because of ws_version.h missing header. This patch offers the possibility to compile this plugin without having to include this header. Furthermore with my wireshark version a "plugin_release" object is required to make it be loaded by wireshark. This is a string which seems to have to match a dotted string made of you wireshark major and minor versions. (cherry picked from commit aab6f7c3e642aa5e298a9d8765b5063abf518bfb) Signed-off-by: Willy Tarreau (cherry picked from commit 9885f4b329dcb8aaacd41ebcffef520cb3d11fb1) Signed-off-by: Christopher Faulet (cherry picked from commit 5172cb0ebbed1ff82acd00a71891c02956025b17) Signed-off-by: Christopher Faulet --- contrib/wireshark-dissectors/peers/Makefile | 2 +- contrib/wireshark-dissectors/peers/README | 10 ++++++++++ contrib/wireshark-dissectors/peers/packet-happp.c | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/contrib/wireshark-dissectors/peers/Makefile b/contrib/wireshark-dissectors/peers/Makefile index 9e70802..95149e7 100644 --- a/contrib/wireshark-dissectors/peers/Makefile +++ b/contrib/wireshark-dissectors/peers/Makefile @@ -1,4 +1,4 @@ -CFLAGS = `pkg-config --cflags wireshark` -g -fPIC +CFLAGS = `pkg-config --cflags wireshark` -g -fPIC $(OPTS) LDFLAGS = `pkg-config --libs wireshark` NAME = packet-happp.so diff --git a/contrib/wireshark-dissectors/peers/README b/contrib/wireshark-dissectors/peers/README index 78cafcd..83b57d2 100644 --- a/contrib/wireshark-dissectors/peers/README +++ b/contrib/wireshark-dissectors/peers/README @@ -37,6 +37,16 @@ redhat-based ones. $ make +It is possible that depending on your distribution the compilation may fail +with such an error: + + packet-happp.c:40:10: fatal error: ws_version.h: No such file or directory + #include + +In this case try to build this plugins with this OPTS variable: + +$ OPTS=-DWITHOUT_WS_VERSION make + To install it in your home directory: $ make install diff --git a/contrib/wireshark-dissectors/peers/packet-happp.c b/contrib/wireshark-dissectors/peers/packet-happp.c index b9e9253..ff46e74 100644 --- a/contrib/wireshark-dissectors/peers/packet-happp.c +++ b/contrib/wireshark-dissectors/peers/packet-happp.c @@ -36,9 +36,25 @@ #include #include +#ifndef WITHOUT_WS_VERSION #include +#endif + +#ifndef WIRESHARK_VERSION_MAJOR +#define WIRESHARK_VERSION_MAJOR VERSION_MAJOR +#endif +#ifndef WIRESHARK_VERSION_MINOR +#define WIRESHARK_VERSION_MINOR VERSION_MINOR +#endif +#ifndef WIRESHARK_VERSION_MICRO +#define WIRESHARK_VERSION_MICRO VERSION_MICRO +#endif + +#define HAPP_STR(str) #str +#define HAPP_XSTR(str) HAPP_STR(str) WS_DLL_PUBLIC_DEF const gchar plugin_version[] = "0.0.1"; +WS_DLL_PUBLIC_DEF const gchar plugin_release[] = HAPP_XSTR(WIRESHARK_VERSION_MAJOR.WIRESHARK_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); -- 1.7.10.4