When updating a plugin dissector to a newer1 version of wireshark, you need to update all of the essential build files for your plugin to use the new style. There are additional changes to the API that will need adjustment in your code, but by making the below changes, you should be able to begin to build your dissectors and work through the changes.
CMakeLists.txt before
set_target_properties(foo PROPERTIES SOVERSION ${CPACK_PACKAGE_VERSION})
set_target_properties(foo PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
CMakeLists.txt after
set_target_properties(foo PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(foo PROPERTIES FOLDER "Plugins")
Makefile.am before
INCLUDES = -I$(top_srcdir) -I(includedir)
# ...
foo_la_SOURCES = \
plugin.c \
moduleinfo.h \
$(DISSECTOR_SRC) \
$(DISSECTOR_SUPPORT_SRC) \
$(DISSECTOR_INCLUDES)
# ...
plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \
$(top_srcdir)/tools/make-dissector-reg.py
@if test -n "$(PYTHON)"; then \
echo Making plugin.c with python ; \
$(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
plugin $(DISSECTOR_SRC) ; \
else \
echo Making plugin.c with shell script ; \
$(top_srcdir)/tools/make-dissector-reg $(srcdir) \
$(plugin_src) plugin $(DISSECTOR_SRC) ; \
fi
# ...
checkapi:
$(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput $(DISSECTOR_SRC) $(DISSECTOR_INCLUDES)
Makefile.am after
include $(top_srcdir/Makefile.am.inc
AM_CPPFLAGS = -I$(top_srcdir)
# ...
foo_la_SOURCES = \
plugin.c \
moduleinfo.h \
$(SRC_FILES) \
$(HEADER_FILES)
# ...
plugin.c: $(REGISTER_SRC_FILES) Makefile.common $(top_srcdir)/tools/make-dissector-reg \
$(top_srcdir)/tools/make-dissector-reg.py
@if test -n "$(PYTHON)"; then \
echo Making plugin.c with python ; \
$(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
plugin $(REGISTER_SRC_FILES) ; \
else \
echo Making plugin.c with shell script ; \
$(top_srcdir)/tools/make-dissector-reg $(srcdir) \
$(plugin_src) plugin $(REGISTER_SRC_FILES) ; \
fi
# ...
checkapi:
$(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput -build \
-sourcedir=$(srcdir) \
$(CLEAN_SRC_FILES) $(CLEAN_HEADER_FILES)
Makefile.nmake before
CFLAGS=/D_NEED_VAR_IMPORT_ $(CFLAGS)
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj)
OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) plugin.obj
# ...
!IFDEF PYTHON
plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg.py
@echo Making plugin.c (using python)
@$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC)
!ELSE
plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
@echo Making plugin.c (using sh)
@$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC)
!ENDIF
Makefile.nmake after
CFLAGS=$(CFLAGS)
OBJECTS = $(C_FILES:.c=.obj) $(CPP_FILES:.cpp=.obj) plugin.obj
# ...
!IFDEF PYTHON
plugin.c: $(REGISTER_SRC_FILES) moduleinfo.h ../../tools/make-dissector-reg.py
@echo Making plugin.c (using python)
@$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(REGISTER_SRC_FILES)
!ELSE
plugin.c: $(REGISTER_SRC_FILES) moduleinfo.h ../../tools/make-dissector-reg
@echo Making plugin.c (using sh)
@$(SH) ../../tools/make-dissector-reg . plugin $(REGISTER_SRC_FILES)
!ENDIF
Makefile.common before
PLUGIN_NAME = foo
# the dissector sources (without any helpers)
DISSECTOR_SRC = \
packet-foo.c
# corresponding headers
DISSECTOR_INCLUDES = \
packet-foo.h
# Dissector helpers. They're included in the source files in this
# directory, but they're not dissectors themselves, i.e. they're not
# used to generate "plugin.c".
DISSECTOR_SUPPORT_SRC = \</code>
Makefile.common after
PLUGIN_NAME = foo
# the dissector sources (without any helpers)
NONGENERATED_REGISTER_C_FILES = \
packet-foo.c
NONGENERATED_C_FILES = \
$(NONGENERATED_REGISTER_C_FILES)
# corresponding headers
CLEAN_HEADER_FILES = \
packet-foo.h
HEADER_FILES = \
$(CLEAN_HEADER_FILES)
include ../Makefile.common.inc
1: I don't know at what point the change actually happened. In my case, I was updating from 1.8 to 1.99.
answered 13 Aug '14, 12:36
multipleinte...
1.3k●15●23●40
accept rate: 12%
Could you explain more how modifying your Makefile.common fixed the problem? I suspect many people who try to update their custom dissectors from an older version will run into this problem.
In the Makefile.common There is a variable for source files called NONGENERATED_C_FILES. The files listed aren't actual dissectors themselves but they are supporting source files listed in here. In this list of files, there should be the MACRO/Variable Expansion thingy called $(NONGENERATED_REGISTER_C_FILES) listed with the source files.
This is three months ago so my memory is a little dim on this but I've looked at the Make files to help figure this out. I believe looking at other plugin files helped me to troubleshoot this. The mate plugin looks like a decent example of this.
So why doesn't anyone vote up answers and questions that are helpful? Shouldn't the correct behavior be promoted?