Don't allow capturing from multiple interface when compiled with multiple thread

support.

svn path=/trunk/; revision=38057
This commit is contained in:
Michael Tüxen 2011-07-16 11:07:32 +00:00
parent d00167886f
commit 09af2bc6d2
4 changed files with 40 additions and 5 deletions

View File

@ -2706,6 +2706,13 @@ capture_start_cb(GtkWidget *w _U_, gpointer d _U_)
return; /* error in options dialog */
}
#ifndef USE_THREADS
if (global_capture_opts.ifaces->len > 1) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"You specified multiple interfaces for capturing which this version of Wireshark doesn't support.");
return;
}
#endif
if (global_capture_opts.ifaces->len == 0) {
if (prefs.capture_device == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,

View File

@ -158,7 +158,11 @@ store_selected(GtkWidget *choose_bt _U_, gpointer if_data)
}
}
if (cap_if_w) {
#ifdef USE_THREADS
gtk_widget_set_sensitive(capture_bt, !gbl_capture_in_progress && (currently_selected > 0));
#else
gtk_widget_set_sensitive(capture_bt, !gbl_capture_in_progress && (currently_selected == 1));
#endif
gtk_widget_set_sensitive(options_bt, !gbl_capture_in_progress && (currently_selected <= 1));
}
}
@ -237,7 +241,7 @@ capture_do_cb(GtkWidget *capture_bt _U_, gpointer if_data _U_)
global_capture_opts.save_file = NULL;
}
if (global_capture_opts.ifaces->len >= 2) {
if (global_capture_opts.ifaces->len > 1) {
global_capture_opts.use_pcapng = TRUE;
}
/* stop capturing from all interfaces, we are going to do real work now ... */
@ -306,7 +310,7 @@ capture_prepare_cb(GtkWidget *prepare_bt _U_, gpointer if_data _U_)
}
/* stop capturing from all interfaces, we are going to do real work now ... */
window_destroy(cap_if_w);
if (global_capture_opts.ifaces->len >= 2) {
if (global_capture_opts.ifaces->len > 1) {
global_capture_opts.use_pcapng = TRUE;
}
capture_prep_cb(NULL, NULL);
@ -389,7 +393,11 @@ set_capture_if_dialog_for_capture_in_progress(gboolean capture_in_progress)
gbl_capture_in_progress = capture_in_progress;
if (cap_if_w) {
gtk_widget_set_sensitive(stop_bt, capture_in_progress);
#ifdef USE_THREADS
gtk_widget_set_sensitive(capture_bt, !capture_in_progress && (currently_selected > 0));
#else
gtk_widget_set_sensitive(capture_bt, !capture_in_progress && (currently_selected == 1));
#endif
gtk_widget_set_sensitive(options_bt, !capture_in_progress && (currently_selected <= 1));
}
}

View File

@ -2762,6 +2762,12 @@ main(int argc, char *argv[])
prefs_apply_all();
#ifdef HAVE_LIBPCAP
#ifndef USE_THREADS
if ((global_capture_opts.ifaces->len > 0) && 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;
@ -2992,8 +2998,7 @@ main(int argc, char *argv[])
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);

View File

@ -873,11 +873,18 @@ static void capture_if_start(GtkWidget *w _U_, gpointer data _U_)
view = g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
entry = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
len = gtk_tree_selection_count_selected_rows(entry);
if (!entry || len==0) {
if (!entry || len == 0) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"You didn't specify an interface on which to capture packets.");
return;
}
#ifndef USE_THREADS
if (len > 1) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"You specified multiple interfaces for capturing which this version of Wireshark doesn't support.");
return;
}
#endif
while (global_capture_opts.ifaces->len > 0) {
interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, 0);
global_capture_opts.ifaces = g_array_remove_index(global_capture_opts.ifaces, 0);
@ -1051,11 +1058,19 @@ welcome_new(void)
gtk_tree_view_column_set_visible(column, FALSE);
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(if_view));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
#ifdef USE_THREADS
item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_START,
"Start",
"Choose one or more interfaces to capture from, then <b>Start</b>",
"Same as Capture/Interfaces with default options",
(welcome_button_callback_t)capture_if_start, (gpointer)if_view);
#else
item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_START,
"Start",
"Choose exactly one interface to capture from, then <b>Start</b>",
"Same as Capture/Interfaces with default options",
(welcome_button_callback_t)capture_if_start, (gpointer)if_view);
#endif
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
welcome_if_tree_load();
gtk_container_add (GTK_CONTAINER (swindow), if_view);