#include <unistd.h>
#endif
-#ifdef NEED_STRERROR_H
-#include "wsutil/strerror.h"
-#endif
-
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
if (gpf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open global preferences file\n\"%s\": %s.", gpf_path,
- strerror(gpf_open_errno));
+ g_strerror(gpf_open_errno));
}
if (gpf_read_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"I/O error reading global preferences file\n\"%s\": %s.", gpf_path,
- strerror(gpf_read_errno));
+ g_strerror(gpf_read_errno));
}
}
if (pf_path != NULL) {
if (pf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open your preferences file\n\"%s\": %s.", pf_path,
- strerror(pf_open_errno));
+ g_strerror(pf_open_errno));
}
if (pf_read_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"I/O error reading your preferences file\n\"%s\": %s.", pf_path,
- strerror(pf_read_errno));
+ g_strerror(pf_read_errno));
}
g_free(pf_path);
pf_path = NULL;
if (cf_path != NULL) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open your capture filter file\n\"%s\": %s.", cf_path,
- strerror(cf_open_errno));
+ g_strerror(cf_open_errno));
g_free(cf_path);
}
if (df_path != NULL) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open your display filter file\n\"%s\": %s.", df_path,
- strerror(df_open_errno));
+ g_strerror(df_open_errno));
g_free(df_path);
}
if (gdp_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open global disabled protocols file\n\"%s\": %s.",
- *gdp_path, strerror(gdp_open_errno));
+ *gdp_path, g_strerror(gdp_open_errno));
}
if (gdp_read_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"I/O error reading global disabled protocols file\n\"%s\": %s.",
- *gdp_path, strerror(gdp_read_errno));
+ *gdp_path, g_strerror(gdp_read_errno));
}
g_free(*gdp_path);
*gdp_path = NULL;
if (dp_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open your disabled protocols file\n\"%s\": %s.", *dp_path,
- strerror(dp_open_errno));
+ g_strerror(dp_open_errno));
}
if (dp_read_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"I/O error reading your disabled protocols file\n\"%s\": %s.", *dp_path,
- strerror(dp_read_errno));
+ g_strerror(dp_read_errno));
}
g_free(*dp_path);
*dp_path = NULL;
cur_group = get_cur_groupname();
priv_warning_dialog = simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Running as user \"%s\" and group \"%s\".\n"
- "This could be dangerous.", cur_user, cur_group);
+ "This could be dangerous.\n\n"
+ "If you're running Wireshark this way in order to perform live capture, "
+ "you may want to be aware that there is a better way documented at\n"
+ "http://wiki.wireshark.org/CaptureSetup/CapturePrivileges", cur_user, cur_group);
g_free(cur_user);
g_free(cur_group);
simple_dialog_check_set(priv_warning_dialog, "Don't show this message again.");
if (rf_path != NULL && rf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open common recent file\n\"%s\": %s.",
- rf_path, strerror(rf_open_errno));
+ rf_path, g_strerror(rf_open_errno));
}
/* "pre-scan" the command line parameters, if we have "console only"
if (rf_path != NULL && rf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.",
- rf_path, strerror(rf_open_errno));
+ rf_path, g_strerror(rf_open_errno));
}
if (recent.gui_fileopen_remembered_dir &&
optind = optind_initial;
opterr = 1;
+#ifdef USE_THREADS
+ g_thread_init(NULL);
+#endif
+
/* Set the current locale according to the program environment.
* We haven't localized anything, but some GTK widgets are localized
* (the file selection dialogue, for example).
timestamp_set_type(TS_DELTA_DIS);
else if (strcmp(optarg, "e") == 0)
timestamp_set_type(TS_EPOCH);
+ else if (strcmp(optarg, "u") == 0)
+ timestamp_set_type(TS_UTC);
+ else if (strcmp(optarg, "ud") == 0)
+ timestamp_set_type(TS_UTC_WITH_DATE);
else {
cmdarg_err("Invalid time stamp type \"%s\"", optarg);
cmdarg_err_cont("It must be \"r\" for relative, \"a\" for absolute,");
line that their preferences have changed. */
prefs_apply_all();
+#ifdef HAVE_LIBPCAP
+#ifndef USE_THREADS
+ if ((global_capture_opts.ifaces->len > 1) && start_capture) {
+ cmdarg_err("You specified multiple interfaces for capturing which this version of Wireshark doesn't support.");
+ exit(2);
+ }
+#endif
+ if ((global_capture_opts.ifaces->len == 0) &&
+ (prefs.capture_device != NULL)) {
+ interface_options interface_opts;
+
+ interface_opts.name = g_strdup(get_if_name(prefs.capture_device));
+ interface_opts.descr = get_interface_descriptive_name(interface_opts.name);
+ interface_opts.monitor_mode = prefs_capture_device_monitor_mode(interface_opts.name);
+ interface_opts.linktype = capture_dev_user_linktype_find(interface_opts.name);
+ interface_opts.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
+ interface_opts.snaplen = global_capture_opts.default_options.snaplen;
+ interface_opts.has_snaplen = global_capture_opts.default_options.has_snaplen;
+ interface_opts.promisc_mode = global_capture_opts.default_options.promisc_mode;
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+ interface_opts.buffer_size = global_capture_opts.default_options.buffer_size;
+#endif
+#ifdef HAVE_PCAP_REMOTE
+ interface_opts.src_type = global_capture_opts.default_options.src_type;
+ interface_opts.remote_host = g_strdup(global_capture_opts.default_options.remote_host);
+ interface_opts.remote_port = g_strdup(global_capture_opts.default_options.remote_port);
+ interface_opts.auth_type = global_capture_opts.default_options.auth_type;
+ interface_opts.auth_username = g_strdup(global_capture_opts.default_options.auth_username);
+ interface_opts.auth_password = g_strdup(global_capture_opts.default_options.auth_password);
+ interface_opts.datatx_udp = global_capture_opts.default_options.datatx_udp;
+ interface_opts.nocap_rpcap = global_capture_opts.default_options.nocap_rpcap;
+ interface_opts.nocap_local = global_capture_opts.default_options.nocap_local;
+ #endif
+ #ifdef HAVE_PCAP_SETSAMPLING
+ interface_opts.sampling_method = global_capture_opts.default_options.sampling_method;
+ interface_opts.sampling_param = global_capture_opts.default_options.sampling_param;
+ #endif
+ g_array_insert_val(global_capture_opts.ifaces, 0, interface_opts);
+ }
+#endif
+
/* disabled protocols as per configuration file */
if (gdp_path == NULL && dp_path == NULL) {
set_disabled_protos_list();
if (rf_path != NULL && rf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.",
- rf_path, strerror(rf_open_errno));
+ rf_path, g_strerror(rf_open_errno));
}
color_filters_enable(recent.packet_list_colorize);
one of MATE's late-registered fields as part of the filter. */
start_requested_stats();
}
- }
- else {
+ } else {
show_main_window(FALSE);
check_and_warn_user_startup(cf_name);
set_menus_for_capture_in_progress(FALSE);
set_capture_if_dialog_for_capture_in_progress(FALSE);
}
- /* if the user didn't supplied a capture filter, use the one to filter out remote connections like SSH */
- if (!start_capture && !global_capture_opts.cfilter) {
- global_capture_opts.cfilter = g_strdup(get_conn_cfilter());
+ /* if the user didn't supply a capture filter, use the one to filter out remote connections like SSH */
+ if (!start_capture && !global_capture_opts.default_options.cfilter) {
+ global_capture_opts.default_options.cfilter = g_strdup(get_conn_cfilter());
}
#else /* HAVE_LIBPCAP */
show_main_window(FALSE);
if (!have_capture_file) {
if(welcome_pane) {
gtk_widget_show(welcome_pane);
+ select_ifaces();
}
} else {
gtk_widget_hide(welcome_pane);
#ifdef HAVE_LIBPCAP
/* Set promiscuous mode from the preferences setting. */
/* the same applies to other preferences settings as well. */
- global_capture_opts.promisc_mode = prefs.capture_prom_mode;
- global_capture_opts.use_pcapng = prefs.capture_pcap_ng;
- global_capture_opts.show_info = prefs.capture_show_info;
- global_capture_opts.real_time_mode = prefs.capture_real_time;
- auto_scroll_live = prefs.capture_auto_scroll;
+ global_capture_opts.default_options.promisc_mode = prefs.capture_prom_mode;
+ global_capture_opts.use_pcapng = prefs.capture_pcap_ng;
+ global_capture_opts.show_info = prefs.capture_show_info;
+ global_capture_opts.real_time_mode = prefs.capture_real_time;
+ auto_scroll_live = prefs.capture_auto_scroll;
#endif /* HAVE_LIBPCAP */
/* Set the name resolution code's flags from the preferences. */
if (create_persconffile_profile(profile_name, &pf_dir_path) == -1) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't create directory\n\"%s\":\n%s.",
- pf_dir_path, strerror(errno));
+ pf_dir_path, g_strerror(errno));
g_free(pf_dir_path);
}
&pf_dir_path, &pf_dir_path2) == -1) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't copy file \"%s\" in directory\n\"%s\" to\n\"%s\":\n%s.",
- pf_filename, pf_dir_path2, pf_dir_path, strerror(errno));
+ pf_filename, pf_dir_path2, pf_dir_path, g_strerror(errno));
g_free(pf_filename);
g_free(pf_dir_path);
if (rf_path != NULL && rf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open common recent file\n\"%s\": %s.",
- rf_path, strerror(rf_open_errno));
+ rf_path, g_strerror(rf_open_errno));
}
if (recent.gui_fileopen_remembered_dir &&
test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {