aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dftest.c9
-rw-r--r--epan/epan.c5
-rw-r--r--wiretap/wtap.c10
3 files changed, 9 insertions, 15 deletions
diff --git a/dftest.c b/dftest.c
index e9f1df6a23..1c7ba933b5 100644
--- a/dftest.c
+++ b/dftest.c
@@ -31,6 +31,8 @@
#include <wsutil/report_message.h>
#include <wsutil/wslog.h>
+#include <wiretap/wtap.h>
+
#include "ui/util.h"
#include "ui/cmdarg_err.h"
#include "ui/failure_message.h"
@@ -87,6 +89,13 @@ main(int argc, char **argv)
timestamp_set_type(TS_RELATIVE);
timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
+ /*
+ * Libwiretap must be initialized before libwireshark is, so that
+ * dissection-time handlers for file-type-dependent blocks can
+ * register using the file type/subtype value for the file type.
+ */
+ wtap_init(TRUE);
+
/* Register all dissectors; we must do this before checking for the
"-g" flag, as the "-g" flag dumps a list of fields registered
by the dissectors, and we must do it before we read the preferences,
diff --git a/epan/epan.c b/epan/epan.c
index 9820a4327f..85a02ed4ac 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -21,7 +21,6 @@
#include <wsutil/report_message.h>
-#include <wiretap/wtap.h>
#include <epan/exceptions.h>
#include "epan.h"
@@ -247,8 +246,6 @@ epan_init(register_cb cb, gpointer client_data, gboolean load_plugins)
wireshark_abort_on_too_many_items = FALSE;
}
- wtap_init(load_plugins);
-
/*
* proto_init -> register_all_protocols -> g_async_queue_new which
* requires threads to be initialized. This happens automatically with
@@ -431,8 +428,6 @@ epan_cleanup(void)
}
wmem_cleanup_scopes();
-
- wtap_cleanup();
}
struct epan_session {
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 9f8308740d..d4a5524acc 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -25,8 +25,6 @@
#include <wsutil/plugins.h>
#endif
-static gboolean wiretap_initialized = FALSE;
-
#ifdef HAVE_PLUGINS
static plugins_t *libwiretap_plugins = NULL;
#endif
@@ -1840,9 +1838,6 @@ wtap_full_file_seek_read(wtap *wth, gint64 seek_off, wtap_rec *rec, Buffer *buf,
void
wtap_init(gboolean load_wiretap_plugins)
{
- if (wiretap_initialized)
- return;
-
init_open_routines();
wtap_opttypes_initialize();
wtap_init_encap_types();
@@ -1853,7 +1848,6 @@ wtap_init(gboolean load_wiretap_plugins)
#endif
g_slist_foreach(wtap_plugins, call_plugin_register_wtap_module, NULL);
}
- wiretap_initialized = TRUE;
}
/*
@@ -1862,9 +1856,6 @@ wtap_init(gboolean load_wiretap_plugins)
void
wtap_cleanup(void)
{
- if (!wiretap_initialized)
- return;
-
wtap_cleanup_encap_types();
wtap_opttypes_cleanup();
ws_buffer_cleanup();
@@ -1875,7 +1866,6 @@ wtap_cleanup(void)
plugins_cleanup(libwiretap_plugins);
libwiretap_plugins = NULL;
#endif
- wiretap_initialized = FALSE;
}
/*