forked from osmocom/wireshark
Fix randpkt and reordercap.
Copy over recent wiretap plugin changes from mergecap, otherwise randpkt and reordercap will crash. Change-Id: I70111ded3d9a5c4380b964b2c5b626599eebc327 Reviewed-on: https://code.wireshark.org/review/14546 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
51984de040
commit
c362dc7a52
50
randpkt.c
50
randpkt.c
|
@ -27,7 +27,14 @@
|
|||
#include <wsutil/ws_diag_control.h>
|
||||
#include <wsutil/unicode-utils.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/privileges.h>
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
#include <wsutil/plugins.h>
|
||||
#endif
|
||||
|
||||
#include <wsutil/report_err.h>
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
@ -38,6 +45,19 @@
|
|||
|
||||
#include "randpkt_core/randpkt_core.h"
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
/*
|
||||
* Don't report failures to load plugins because most (non-wiretap) plugins
|
||||
* *should* fail to load (because we're not linked against libwireshark and
|
||||
* dissector plugins need libwireshark).
|
||||
*/
|
||||
static void
|
||||
failure_message(const char *msg_format _U_, va_list ap _U_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Print usage statement and exit program */
|
||||
static void
|
||||
usage(gboolean is_error)
|
||||
|
@ -91,11 +111,41 @@ main(int argc, char **argv)
|
|||
{0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
char *init_progfile_dir_error;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Get credential information for later use.
|
||||
*/
|
||||
init_process_policies();
|
||||
init_open_routines();
|
||||
|
||||
#ifdef _WIN32
|
||||
arg_list_utf_16to8(argc, argv);
|
||||
create_app_running_mutex();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
/* Register wiretap plugins */
|
||||
if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) {
|
||||
g_warning("randpkt: init_progfile_dir(): %s", init_progfile_dir_error);
|
||||
g_free(init_progfile_dir_error);
|
||||
} else {
|
||||
/* Register all the plugin types we have. */
|
||||
wtap_register_plugin_types(); /* Types known to libwiretap */
|
||||
|
||||
init_report_err(failure_message,NULL,NULL,NULL);
|
||||
|
||||
/* Scan for plugins. This does *not* call their registration routines;
|
||||
that's done later. */
|
||||
scan_plugins();
|
||||
|
||||
/* Register all libwiretap plugin modules. */
|
||||
register_all_wiretap_modules();
|
||||
}
|
||||
#endif
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "b:c:ht:r", long_options, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'b': /* max bytes */
|
||||
|
|
51
reordercap.c
51
reordercap.c
|
@ -43,11 +43,19 @@
|
|||
#endif
|
||||
|
||||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/filesystem.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <wsutil/privileges.h>
|
||||
#include <wsutil/ws_diag_control.h>
|
||||
#include <wsutil/ws_version_info.h>
|
||||
#include <wiretap/wtap_opttypes.h>
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
#include <wsutil/plugins.h>
|
||||
#endif
|
||||
|
||||
#include <wsutil/report_err.h>
|
||||
|
||||
/* Show command-line usage */
|
||||
static void
|
||||
print_usage(FILE *output)
|
||||
|
@ -169,6 +177,19 @@ get_reordercap_runtime_info(GString *str)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
/*
|
||||
* Don't report failures to load plugins because most (non-wiretap) plugins
|
||||
* *should* fail to load (because we're not linked against libwireshark and
|
||||
* dissector plugins need libwireshark).
|
||||
*/
|
||||
static void
|
||||
failure_message(const char *msg_format _U_, va_list ap _U_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/********************************************************************/
|
||||
/* Main function. */
|
||||
/********************************************************************/
|
||||
|
@ -205,6 +226,10 @@ main(int argc, char *argv[])
|
|||
char *infile;
|
||||
const char *outfile;
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
char *init_progfile_dir_error;
|
||||
#endif
|
||||
|
||||
/* Get the compile-time version information string */
|
||||
comp_info_str = get_compiled_version_info(NULL, get_reordercap_compiled_info);
|
||||
|
||||
|
@ -219,6 +244,32 @@ main(int argc, char *argv[])
|
|||
"%s",
|
||||
get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str);
|
||||
|
||||
/*
|
||||
* Get credential information for later use.
|
||||
*/
|
||||
init_process_policies();
|
||||
init_open_routines();
|
||||
|
||||
#ifdef HAVE_PLUGINS
|
||||
/* Register wiretap plugins */
|
||||
if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) {
|
||||
g_warning("reordercap: init_progfile_dir(): %s", init_progfile_dir_error);
|
||||
g_free(init_progfile_dir_error);
|
||||
} else {
|
||||
/* Register all the plugin types we have. */
|
||||
wtap_register_plugin_types(); /* Types known to libwiretap */
|
||||
|
||||
init_report_err(failure_message,NULL,NULL,NULL);
|
||||
|
||||
/* Scan for plugins. This does *not* call their registration routines;
|
||||
that's done later. */
|
||||
scan_plugins();
|
||||
|
||||
/* Register all libwiretap plugin modules. */
|
||||
register_all_wiretap_modules();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Process the options first */
|
||||
while ((opt = getopt_long(argc, argv, "hnv", long_options, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
|
|
Loading…
Reference in New Issue