forked from osmocom/wireshark
Make sure that the interfaces listed in ifaces really exist.
Some protection code in capture / options. Obtained from Irene Ruengeler. svn path=/trunk/; revision=38142
This commit is contained in:
parent
5014f11884
commit
91df20357a
|
@ -441,6 +441,7 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
|
|||
int err;
|
||||
gchar *err_str;
|
||||
interface_options interface_opts;
|
||||
gboolean found = FALSE;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -451,6 +452,21 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
|
|||
* names that begin with digits. It can be useful on Windows, where
|
||||
* more than one interface can have the same name.
|
||||
*/
|
||||
if_list = capture_interface_list(&err, &err_str);
|
||||
if (if_list == NULL) {
|
||||
switch (err) {
|
||||
|
||||
case CANT_GET_INTERFACE_LIST:
|
||||
cmdarg_err("%s", err_str);
|
||||
g_free(err_str);
|
||||
break;
|
||||
|
||||
case NO_INTERFACES_FOUND:
|
||||
cmdarg_err("There are no interfaces on which a capture can be done");
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
adapter_index = strtol(optarg_str_p, &p, 10);
|
||||
if (p != NULL && *p == '\0') {
|
||||
if (adapter_index < 0) {
|
||||
|
@ -466,63 +482,66 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
|
|||
cmdarg_err("There is no interface with that adapter index");
|
||||
return 1;
|
||||
}
|
||||
if_list = capture_interface_list(&err, &err_str);
|
||||
if (if_list == NULL) {
|
||||
switch (err) {
|
||||
|
||||
case CANT_GET_INTERFACE_LIST:
|
||||
cmdarg_err("%s", err_str);
|
||||
g_free(err_str);
|
||||
break;
|
||||
|
||||
case NO_INTERFACES_FOUND:
|
||||
cmdarg_err("There are no interfaces on which a capture can be done");
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
if_info = (if_info_t *)g_list_nth_data(if_list, adapter_index - 1);
|
||||
if (if_info == NULL) {
|
||||
cmdarg_err("There is no interface with that adapter index");
|
||||
return 1;
|
||||
}
|
||||
found = TRUE;
|
||||
interface_opts.name = g_strdup(if_info->name);
|
||||
/* We don't set iface_descr here because doing so requires
|
||||
* capture_ui_utils.c which requires epan/prefs.c which is
|
||||
* probably a bit too much dependency for here...
|
||||
*/
|
||||
free_interface_list(if_list);
|
||||
} else {
|
||||
interface_opts.name = g_strdup(optarg_str_p);
|
||||
GList *curr;
|
||||
|
||||
for (curr = g_list_first(if_list); curr; curr = g_list_next(curr)) {
|
||||
if_info = curr->data;
|
||||
if (strcmp(if_info->name, optarg_str_p) == 0) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
interface_opts.name = g_strdup(optarg_str_p);
|
||||
}
|
||||
}
|
||||
interface_opts.descr = g_strdup(capture_opts->default_options.descr);
|
||||
interface_opts.cfilter = g_strdup(capture_opts->default_options.cfilter);
|
||||
interface_opts.snaplen = capture_opts->default_options.snaplen;
|
||||
interface_opts.has_snaplen = capture_opts->default_options.has_snaplen;
|
||||
interface_opts.linktype = capture_opts->default_options.linktype;
|
||||
interface_opts.promisc_mode = capture_opts->default_options.promisc_mode;
|
||||
free_interface_list(if_list);
|
||||
if (found) {
|
||||
interface_opts.descr = g_strdup(capture_opts->default_options.descr);
|
||||
interface_opts.cfilter = g_strdup(capture_opts->default_options.cfilter);
|
||||
interface_opts.snaplen = capture_opts->default_options.snaplen;
|
||||
interface_opts.has_snaplen = capture_opts->default_options.has_snaplen;
|
||||
interface_opts.linktype = capture_opts->default_options.linktype;
|
||||
interface_opts.promisc_mode = capture_opts->default_options.promisc_mode;
|
||||
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
|
||||
interface_opts.buffer_size = capture_opts->default_options.buffer_size;
|
||||
interface_opts.buffer_size = capture_opts->default_options.buffer_size;
|
||||
#endif
|
||||
interface_opts.monitor_mode = capture_opts->default_options.monitor_mode;
|
||||
interface_opts.monitor_mode = capture_opts->default_options.monitor_mode;
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
interface_opts.src_type = capture_opts->default_options.src_type;
|
||||
interface_opts.remote_host = g_strdup(capture_opts->default_options.remote_host);
|
||||
interface_opts.remote_port = g_strdup(capture_opts->default_options.remote_port);
|
||||
interface_opts.auth_type = capture_opts->default_options.auth_type;
|
||||
interface_opts.auth_username = g_strdup(capture_opts->default_options.auth_username);
|
||||
interface_opts.auth_password = g_strdup(capture_opts->default_options.auth_password);
|
||||
interface_opts.datatx_udp = capture_opts->default_options.datatx_udp;
|
||||
interface_opts.nocap_rpcap = capture_opts->default_options.nocap_rpcap;
|
||||
interface_opts.nocap_local = capture_opts->default_options.nocap_local;
|
||||
interface_opts.src_type = capture_opts->default_options.src_type;
|
||||
interface_opts.remote_host = g_strdup(capture_opts->default_options.remote_host);
|
||||
interface_opts.remote_port = g_strdup(capture_opts->default_options.remote_port);
|
||||
interface_opts.auth_type = capture_opts->default_options.auth_type;
|
||||
interface_opts.auth_username = g_strdup(capture_opts->default_options.auth_username);
|
||||
interface_opts.auth_password = g_strdup(capture_opts->default_options.auth_password);
|
||||
interface_opts.datatx_udp = capture_opts->default_options.datatx_udp;
|
||||
interface_opts.nocap_rpcap = capture_opts->default_options.nocap_rpcap;
|
||||
interface_opts.nocap_local = capture_opts->default_options.nocap_local;
|
||||
#endif
|
||||
#ifdef HAVE_PCAP_SETSAMPLING
|
||||
interface_opts.sampling_method = capture_opts->default_options.sampling_method;
|
||||
interface_opts.sampling_param = capture_opts->default_options.sampling_param;
|
||||
interface_opts.sampling_method = capture_opts->default_options.sampling_method;
|
||||
interface_opts.sampling_param = capture_opts->default_options.sampling_param;
|
||||
#endif
|
||||
|
||||
g_array_append_val(capture_opts->ifaces, interface_opts);
|
||||
|
||||
g_array_append_val(capture_opts->ifaces, interface_opts);
|
||||
} else {
|
||||
cmdarg_err("There is no interface with that name (%s)", optarg_str_p);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ capture_get_cap_settings (gchar *if_name)
|
|||
cap_settings = *cap_settings_p;
|
||||
} else {
|
||||
cap_settings.monitor_mode = prefs_capture_device_monitor_mode(if_name);
|
||||
cap_settings.linktype = capture_dev_user_linktype_find(if_name);;
|
||||
cap_settings.linktype = capture_dev_user_linktype_find(if_name);
|
||||
}
|
||||
|
||||
return cap_settings;
|
||||
|
@ -1678,7 +1678,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
GtkAdjustment *snap_adj, *ringbuffer_nbf_adj,
|
||||
*stop_packets_adj, *stop_filesize_adj, *stop_duration_adj, *stop_files_adj,
|
||||
*ring_filesize_adj, *file_duration_adj;
|
||||
GList *if_list = NULL, *combo_list, *cfilter_list, *if_entry;
|
||||
GList *if_list = NULL, *combo_list, *cfilter_list;
|
||||
int row;
|
||||
int err;
|
||||
gchar *err_str = NULL;
|
||||
|
@ -1741,11 +1741,11 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
if_info = g_list_first(if_list)->data;
|
||||
interface_opts.name = g_strdup(if_info->name);
|
||||
interface_opts.descr = get_interface_descriptive_name(interface_opts.name);
|
||||
interface_opts.linktype = capture_dev_user_linktype_find(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.has_snaplen = global_capture_opts.default_options.has_snaplen;
|
||||
interface_opts.snaplen = global_capture_opts.default_options.snaplen;
|
||||
cap_settings = capture_get_cap_settings (interface_opts.name);;
|
||||
cap_settings = capture_get_cap_settings (interface_opts.name);
|
||||
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;
|
||||
|
@ -1767,10 +1767,10 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
interface_opts.sampling_param = global_capture_opts.default_options.sampling_param;
|
||||
#endif
|
||||
g_array_append_val(global_capture_opts.ifaces, interface_opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
if (interface_opts.src_type == CAPTURE_IFREMOTE) {
|
||||
if (global_capture_opts.ifaces->len > 0 && interface_opts.src_type == CAPTURE_IFREMOTE) {
|
||||
if_list = get_remote_interface_list(interface_opts.remote_host,
|
||||
interface_opts.remote_port,
|
||||
interface_opts.auth_type,
|
||||
|
@ -1849,28 +1849,8 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
gtk_box_pack_start(GTK_BOX(if_hb), iftype_cbx, FALSE, FALSE, 0);
|
||||
#endif
|
||||
|
||||
if (interface_opts.name == NULL && prefs.capture_device != NULL) {
|
||||
/* No interface was specified on the command line or in a previous
|
||||
capture, but there is one specified in the preferences file;
|
||||
make the one from the preferences file the default */
|
||||
if_device = g_strdup(prefs.capture_device);
|
||||
for (if_entry = if_list; if_entry != NULL; if_entry = g_list_next(if_entry)) {
|
||||
if_info = (if_info_t*)if_entry->data;
|
||||
if (strcmp(if_info->name, get_if_name(if_device)) == 0) {
|
||||
interface_opts.name = g_strdup(get_if_name(if_device));
|
||||
/* Warning: see capture_prep_cb() */
|
||||
/* XXX: Could the following code be changed to use the if_list obtained above instead */
|
||||
/* of maybe calling capture_interface_list() again ? */
|
||||
interface_opts.descr = get_interface_descriptive_name(interface_opts.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_free(if_device);
|
||||
if_device = NULL;
|
||||
}
|
||||
|
||||
/* If we have a prefered interface, get the string to compare with to select the active text*/
|
||||
if (interface_opts.name != NULL) {
|
||||
if (global_capture_opts.ifaces->len > 0 && interface_opts.name != NULL) {
|
||||
if_device = build_capture_combo_name(if_list, interface_opts.name);
|
||||
}
|
||||
#if GTK_CHECK_VERSION(2,24,0)
|
||||
|
@ -1912,13 +1892,14 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
#ifdef HAVE_AIRPCAP
|
||||
/* get the airpcap interface (if it IS an airpcap interface, and update the
|
||||
toolbar... and of course enable the advanced button...)*/
|
||||
airpcap_if_selected = get_airpcap_if_from_name(airpcap_if_list,interface_opts.name);
|
||||
if (global_capture_opts.ifaces->len >= 0)
|
||||
airpcap_if_selected = get_airpcap_if_from_name(airpcap_if_list,interface_opts.name);
|
||||
#endif
|
||||
|
||||
free_capture_combo_list(combo_list);
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
/* Only delete if fetched local */
|
||||
if (interface_opts.src_type == CAPTURE_IFLOCAL)
|
||||
if (global_capture_opts.ifaces->len >= 0 && interface_opts.src_type == CAPTURE_IFLOCAL)
|
||||
#endif
|
||||
free_interface_list(if_list);
|
||||
gtk_widget_set_tooltip_text(if_cb,
|
||||
|
@ -1997,8 +1978,13 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
/* Promiscuous mode row */
|
||||
promisc_cb = gtk_check_button_new_with_mnemonic(
|
||||
"Capture packets in _promiscuous mode");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(promisc_cb),
|
||||
if (global_capture_opts.ifaces->len > 0) {
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(promisc_cb),
|
||||
interface_opts.promisc_mode);
|
||||
} else {
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(promisc_cb),
|
||||
global_capture_opts.default_options.promisc_mode);
|
||||
}
|
||||
gtk_widget_set_tooltip_text(promisc_cb,
|
||||
"Usually a network adapter will only capture the traffic sent to its own network address. "
|
||||
"If you want to capture all traffic that the network adapter can \"see\", mark this option. "
|
||||
|
@ -2009,10 +1995,15 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
/* Monitor mode row */
|
||||
monitor_cb = gtk_check_button_new_with_mnemonic(
|
||||
"Capture packets in monitor mode");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(monitor_cb),
|
||||
if (global_capture_opts.ifaces->len > 0) {
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(monitor_cb),
|
||||
interface_opts.monitor_mode);
|
||||
g_signal_connect(monitor_cb, "toggled",
|
||||
g_signal_connect(monitor_cb, "toggled",
|
||||
G_CALLBACK(capture_prep_monitor_changed_cb), NULL);
|
||||
} else {
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(monitor_cb),
|
||||
global_capture_opts.default_options.monitor_mode);
|
||||
}
|
||||
|
||||
gtk_widget_set_tooltip_text(monitor_cb,
|
||||
"Usually a Wi-Fi adapter will, even in promiscuous mode, only capture the traffic on the BSS to which it's associated. "
|
||||
|
@ -2034,12 +2025,14 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
* you have it, the monitor mode checkbox. That's why we do this
|
||||
* now.
|
||||
*/
|
||||
global_capture_opts.ifaces = g_array_remove_index(global_capture_opts.ifaces, 0);
|
||||
/* To keep consistency, the status has to be stored */
|
||||
g_array_insert_val(global_capture_opts.ifaces, 0, interface_opts);
|
||||
set_if_capabilities(FALSE);
|
||||
if (global_capture_opts.ifaces->len > 0) {
|
||||
global_capture_opts.ifaces = g_array_remove_index(global_capture_opts.ifaces, 0);
|
||||
/* To keep consistency, the status has to be stored */
|
||||
g_array_insert_val(global_capture_opts.ifaces, 0, interface_opts);
|
||||
|
||||
interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, 0);
|
||||
set_if_capabilities(FALSE);
|
||||
interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, 0);
|
||||
}
|
||||
/* Pcap-NG row */
|
||||
pcap_ng_cb = gtk_check_button_new_with_mnemonic("Capture packets in pcap-ng format");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pcap_ng_cb), global_capture_opts.use_pcapng);
|
||||
|
@ -2105,7 +2098,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
if (g_array_index(global_capture_opts.ifaces, interface_options, 0).cfilter)
|
||||
if (global_capture_opts.ifaces->len > 0 && g_array_index(global_capture_opts.ifaces, interface_options, 0).cfilter)
|
||||
#if GTK_CHECK_VERSION(2,24,0)
|
||||
gtk_combo_box_text_prepend_text(GTK_COMBO_BOX_TEXT(filter_cm), g_array_index(global_capture_opts.ifaces, interface_options, 0).cfilter);
|
||||
#else
|
||||
|
@ -2170,11 +2163,17 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
buffer_size_hb = gtk_hbox_new(FALSE, 3);
|
||||
buffer_size_lb = gtk_label_new("Buffer size:");
|
||||
gtk_box_pack_start (GTK_BOX(buffer_size_hb), buffer_size_lb, FALSE, FALSE, 0);
|
||||
|
||||
buffer_size_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat) interface_opts.buffer_size,
|
||||
1, 65535, 1.0, 10.0, 0.0);
|
||||
buffer_size_sb = gtk_spin_button_new (buffer_size_adj, 0, 0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON (buffer_size_sb), (gfloat) interface_opts.buffer_size);
|
||||
if (global_capture_opts.ifaces->len > 0) {
|
||||
buffer_size_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat) interface_opts.buffer_size,
|
||||
1, 65535, 1.0, 10.0, 0.0);
|
||||
buffer_size_sb = gtk_spin_button_new (buffer_size_adj, 0, 0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON (buffer_size_sb), (gfloat) interface_opts.buffer_size);
|
||||
} else {
|
||||
buffer_size_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat) global_capture_opts.default_options.buffer_size,
|
||||
1, 65535, 1.0, 10.0, 0.0);
|
||||
buffer_size_sb = gtk_spin_button_new (buffer_size_adj, 0, 0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON (buffer_size_sb), (gfloat) global_capture_opts.default_options.buffer_size);
|
||||
}
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (buffer_size_sb), TRUE);
|
||||
gtk_widget_set_size_request(buffer_size_sb, 80, -1);
|
||||
gtk_widget_set_tooltip_text(buffer_size_sb,
|
||||
|
@ -2503,9 +2502,11 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
gtk_widget_set_tooltip_text(help_bt,
|
||||
"Show help about capturing.");
|
||||
g_signal_connect(help_bt, "clicked", G_CALLBACK(topic_cb), (gpointer)HELP_CAPTURE_OPTIONS_DIALOG);
|
||||
|
||||
global_capture_opts.ifaces = g_array_remove_index(global_capture_opts.ifaces, 0);
|
||||
g_array_insert_val(global_capture_opts.ifaces, 0, interface_opts);
|
||||
|
||||
if (global_capture_opts.ifaces->len > 0) {
|
||||
global_capture_opts.ifaces = g_array_remove_index(global_capture_opts.ifaces, 0);
|
||||
g_array_insert_val(global_capture_opts.ifaces, 0, interface_opts);
|
||||
}
|
||||
gtk_widget_grab_default(ok_bt);
|
||||
|
||||
/* Attach pointers to needed widgets to the capture prefs window/object */
|
||||
|
|
61
gtk/main.c
61
gtk/main.c
|
@ -2770,35 +2770,52 @@ main(int argc, char *argv[])
|
|||
#endif
|
||||
if ((global_capture_opts.ifaces->len == 0) &&
|
||||
(prefs.capture_device != NULL)) {
|
||||
interface_options interface_opts;
|
||||
gboolean found = FALSE;
|
||||
if_list = capture_interface_list(&err, NULL);
|
||||
if (g_list_length(if_list) > 0) {
|
||||
GList *curr;
|
||||
if_info_t *if_info;
|
||||
|
||||
for (curr = g_list_first(if_list); curr; curr = g_list_next(curr)) {
|
||||
if_info = curr->data;
|
||||
if (strcmp(if_info->name, prefs.capture_device) == 0) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free_interface_list(if_list);
|
||||
}
|
||||
if (found) {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
g_array_insert_val(global_capture_opts.ifaces, 0, interface_opts);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ static GtkWidget *welcome_file_panel_vb = NULL;
|
|||
#ifdef HAVE_LIBPCAP
|
||||
static GtkWidget *welcome_if_panel_vb = NULL;
|
||||
static GtkWidget *if_view = NULL;
|
||||
static GtkWidget *swindow;
|
||||
#endif
|
||||
|
||||
static GSList *status_messages = NULL;
|
||||
|
@ -821,7 +822,7 @@ select_ifaces(void)
|
|||
GtkTreeModel *model;
|
||||
GtkTreeSelection *entry;
|
||||
|
||||
if (global_capture_opts.ifaces->len > 0) {
|
||||
if (global_capture_opts.ifaces->len > 0 && swindow) {
|
||||
view = g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
|
||||
model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
|
||||
entry = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
|
||||
|
@ -988,7 +989,6 @@ welcome_new(void)
|
|||
DWORD ce_size = sizeof(chimney_enabled);
|
||||
#endif
|
||||
#ifdef HAVE_LIBPCAP
|
||||
GtkWidget *swindow;
|
||||
GtkTreeSelection *selection;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeViewColumn *column;
|
||||
|
|
Loading…
Reference in New Issue