MINOR: contrib: make the peers wireshark dissector a plugin
The wireshark dissector could only be build within wireshark, which means maintaining a wireshark binary just for this dissector. It was not really convenient to update wireshark because of this. This patch converts the dissector into a .so plugin which is built with the .h found in distributions instead of the whole wireshark sources.
This commit is contained in:
parent
c0e2ff202b
commit
2be58f7584
|
@ -0,0 +1,17 @@
|
|||
CFLAGS = `pkg-config --cflags wireshark` -g -fPIC
|
||||
LDFLAGS = `pkg-config --libs wireshark`
|
||||
|
||||
NAME = packet-happp.so
|
||||
OBJS = packet-happp.o
|
||||
|
||||
plugins=$(HOME)/.wireshark/plugins/
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
$(CC) -shared $(LDFLAGS) $(OBJS) -o $@
|
||||
|
||||
install: $(NAME)
|
||||
install -d $(DESTDIR)$(plugins)
|
||||
install -m 0755 $(NAME) $(DESTDIR)$(plugins)
|
||||
|
||||
clean:
|
||||
rm $(NAME) $(OBJS)
|
|
@ -15,7 +15,7 @@ on Windows systems (could not be tested).
|
|||
packet-happp.c file DISSECTOR_SRC variable which list all wireshark
|
||||
- README: this file.
|
||||
|
||||
2) To build wireshark with HAPPP dissection support
|
||||
2a) To build wireshark with HAPPP dissection support
|
||||
---------------------------------------------------
|
||||
- Download wireshark sources:
|
||||
$ git clone https://code.wireshark.org/review/wireshark
|
||||
|
@ -25,3 +25,44 @@ on Windows systems (could not be tested).
|
|||
$ ./autogen.sh
|
||||
$ ./configure
|
||||
$ make
|
||||
|
||||
2b) Alternative: build the HAPPP dissector as a wireshark plugin
|
||||
-----------------------------------------------------------------
|
||||
If you don't want to build completely wireshark, you can build the dissector as
|
||||
a plugin.
|
||||
|
||||
You will need the development package of your distribution, which is
|
||||
"libwireshark-dev" for debian based distribution and "wireshark-dev" for
|
||||
redhat-based ones.
|
||||
|
||||
$ make
|
||||
|
||||
To install it in your home directory:
|
||||
|
||||
$ make install
|
||||
|
||||
The plugin will be installed in ~/.wireshark/plugins/ by default, but you can
|
||||
change this path by setting the "plugins" variable. If it didn't work, check
|
||||
the paths in "Help > About Wireshark > Folders > Personal Plugins" which should
|
||||
give you the right path to use.
|
||||
|
||||
In some distribution it will be in ~/.local/lib/wireshark/ so you will need to
|
||||
install it this way:
|
||||
|
||||
$ make install plugins=~/.local/lib/wireshark/plugins/3.2/epan/
|
||||
|
||||
If you want to install it in the system directory you can do it this way, the
|
||||
righ path is also in the Folder window. Change the plugins variable this way:
|
||||
|
||||
$ sudo make install plugins=/usr/lib64/wireshark/plugins/3.2/epan/
|
||||
|
||||
Be careful to use the right version number in the path.
|
||||
|
||||
3) Check if you have the dissector in wireshark
|
||||
-----------------------------------------------
|
||||
To verify if the protocol was well loaded by your wireshark, open the Supported
|
||||
Protocols window in "View > Internals > Supported Protocols" and look for
|
||||
"HAPPP".
|
||||
|
||||
In the case of a plugin, you should see your plugin loaded in "Help > About
|
||||
Wireshark > Plugins".
|
||||
|
|
|
@ -27,12 +27,22 @@
|
|||
#include <arpa/inet.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <epan/to_str.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/conversation.h>
|
||||
#include "strutil.h"
|
||||
#include "packet-tcp.h"
|
||||
#include <epan/strutil.h>
|
||||
#include <epan/dissectors/packet-tcp.h>
|
||||
#include <epan/tvbuff.h>
|
||||
|
||||
#include <ws_version.h>
|
||||
|
||||
WS_DLL_PUBLIC_DEF const gchar plugin_version[] = "0.0.1";
|
||||
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);
|
||||
|
||||
|
||||
#define HAPPP_PROTOCOL "HAProxyS"
|
||||
#define HAPPP_MSG_MIN_LEN 2
|
||||
|
@ -49,7 +59,6 @@
|
|||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "tvbuff.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
static unsigned char dbg_buf[16 << 10];
|
||||
|
@ -1630,3 +1639,13 @@ proto_reg_handoff_happp(void)
|
|||
proto_happp, HEURISTIC_ENABLE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
plugin_register(void)
|
||||
{
|
||||
static proto_plugin plug;
|
||||
|
||||
plug.register_protoinfo = proto_register_happp;
|
||||
plug.register_handoff = proto_reg_handoff_happp;
|
||||
proto_register_plugin(&plug);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue