From: Frédéric Lécaille Date: Tue, 19 Jan 2021 13:33:24 +0000 (+0100) Subject: MINOR: contrib: Make the wireshark peers dissector compile for more distribs. X-Git-Tag: v2.4-dev6~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aab6f7c3e642aa5e298a9d8765b5063abf518bfb;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/contrib/wireshark-dissectors/peers/Makefile b/contrib/wireshark-dissectors/peers/Makefile index 9e70802fb8..95149e70e7 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 78cafcd5f6..83b57d2986 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 3490d8b9e7..a5e25640ae 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);