forked from osmocom/wireshark
Fix the capturing from the GUI. Honor the iface variable.
The next step is to retire the iface variable and use the ifaces array only. This should simplify things and fix the cases, where you start wireshark with command line arguments and also use the GUI. svn path=/trunk/; revision=37342
This commit is contained in:
parent
9be282951b
commit
c6c2577bbc
|
@ -361,6 +361,7 @@ sync_pipe_start(capture_options *capture_opts) {
|
|||
int i;
|
||||
guint j;
|
||||
interface_options interface_opts;
|
||||
gboolean no_ifaces;
|
||||
|
||||
if (capture_opts->ifaces->len > 1)
|
||||
capture_opts->use_pcapng = TRUE;
|
||||
|
@ -426,6 +427,7 @@ sync_pipe_start(capture_options *capture_opts) {
|
|||
argv = sync_pipe_add_arg(argv, &argc, sautostop_duration);
|
||||
}
|
||||
if (capture_opts->ifaces->len == 0) {
|
||||
no_ifaces = TRUE;
|
||||
interface_opts.name = g_strdup(capture_opts->iface);
|
||||
if (capture_opts->iface_descr) {
|
||||
interface_opts.descr = g_strdup(capture_opts->iface_descr);
|
||||
|
@ -472,6 +474,8 @@ sync_pipe_start(capture_options *capture_opts) {
|
|||
interface_opts.sampling_param = capture_opts->sampling_param;
|
||||
#endif
|
||||
g_array_append_val(capture_opts->ifaces, interface_opts);
|
||||
} else {
|
||||
no_ifaces = FALSE;
|
||||
}
|
||||
|
||||
for (j = 0; j < capture_opts->ifaces->len; j++) {
|
||||
|
@ -541,6 +545,9 @@ sync_pipe_start(capture_options *capture_opts) {
|
|||
}
|
||||
#endif
|
||||
}
|
||||
if (no_ifaces) {
|
||||
capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, 0);
|
||||
}
|
||||
|
||||
/* dumpcap should be running in capture child mode (hidden feature) */
|
||||
#ifndef DEBUG_CHILD
|
||||
|
|
|
@ -1522,9 +1522,7 @@ main_capture_set_main_window_title(capture_options *capture_opts)
|
|||
GString *title = g_string_new("");
|
||||
|
||||
g_string_append(title, "Capturing ");
|
||||
if (capture_opts->ifaces->len > 0) {
|
||||
g_string_append_printf(title, "from %s ", cf_get_tempfile_source(capture_opts->cf));
|
||||
}
|
||||
g_string_append_printf(title, "from %s ", cf_get_tempfile_source(capture_opts->cf));
|
||||
set_main_window_name(title->str);
|
||||
g_string_free(title, TRUE);
|
||||
}
|
||||
|
|
|
@ -695,6 +695,7 @@ statusbar_get_interface_names(capture_options *capture_opts)
|
|||
GString *interface_names;
|
||||
|
||||
interface_names = g_string_new("");
|
||||
|
||||
if (capture_opts->ifaces->len == 0) {
|
||||
g_string_append_printf(interface_names, "%s", get_iface_description(capture_opts));
|
||||
#ifdef _WIN32
|
||||
|
@ -711,27 +712,26 @@ statusbar_get_interface_names(capture_options *capture_opts)
|
|||
} else {
|
||||
g_string_append_printf(interface_names, "%u interfaces", capture_opts->ifaces->len);
|
||||
}
|
||||
if (strlen (interface_names->str) > 0) {
|
||||
g_string_append(interface_names, ":");
|
||||
}
|
||||
g_string_append(interface_names, " ");
|
||||
return (interface_names);
|
||||
}
|
||||
|
||||
static void
|
||||
statusbar_capture_update_started_cb(capture_options *capture_opts)
|
||||
{
|
||||
GString *interface_names;
|
||||
|
||||
statusbar_pop_file_msg();
|
||||
welcome_header_pop_msg();
|
||||
|
||||
if (capture_opts->ifaces->len > 0) {
|
||||
GString *interface_names;
|
||||
|
||||
interface_names = statusbar_get_interface_names(capture_opts);
|
||||
statusbar_push_file_msg(" %s: <live capture in progress> to file: %s",
|
||||
interface_names->str,
|
||||
(capture_opts->save_file) ? capture_opts->save_file : "");
|
||||
g_string_free(interface_names, TRUE);
|
||||
} else {
|
||||
statusbar_push_file_msg(" <live capture in progress> to file: %s",
|
||||
(capture_opts->save_file) ? capture_opts->save_file : "");
|
||||
}
|
||||
interface_names = statusbar_get_interface_names(capture_opts);
|
||||
statusbar_push_file_msg("%s<live capture in progress> to file: %s",
|
||||
interface_names->str,
|
||||
(capture_opts->save_file) ? capture_opts->save_file : "");
|
||||
g_string_free(interface_names, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -746,17 +746,17 @@ statusbar_capture_update_continue_cb(capture_options *capture_opts)
|
|||
|
||||
interface_names = statusbar_get_interface_names(capture_opts);
|
||||
if (cf->f_datalen/1024/1024 > 10) {
|
||||
statusbar_push_file_msg(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d MB",
|
||||
statusbar_push_file_msg("%s<live capture in progress> File: %s %" G_GINT64_MODIFIER "d MB",
|
||||
interface_names->str,
|
||||
capture_opts->save_file,
|
||||
cf->f_datalen/1024/1024);
|
||||
} else if (cf->f_datalen/1024 > 10) {
|
||||
statusbar_push_file_msg(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d KB",
|
||||
statusbar_push_file_msg("%s<live capture in progress> File: %s %" G_GINT64_MODIFIER "d KB",
|
||||
interface_names->str,
|
||||
capture_opts->save_file,
|
||||
cf->f_datalen/1024);
|
||||
} else {
|
||||
statusbar_push_file_msg(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d Bytes",
|
||||
statusbar_push_file_msg("%s<live capture in progress> File: %s %" G_GINT64_MODIFIER "d Bytes",
|
||||
interface_names->str,
|
||||
capture_opts->save_file,
|
||||
cf->f_datalen);
|
||||
|
@ -783,7 +783,7 @@ statusbar_capture_fixed_started_cb(capture_options *capture_opts)
|
|||
statusbar_pop_file_msg();
|
||||
|
||||
interface_names = statusbar_get_interface_names(capture_opts);
|
||||
statusbar_push_file_msg(" %s: <live capture in progress> to file: %s",
|
||||
statusbar_push_file_msg("%s<live capture in progress> to file: %s",
|
||||
interface_names->str,
|
||||
(capture_opts->save_file) ? capture_opts->save_file : "");
|
||||
|
||||
|
|
Loading…
Reference in New Issue