aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Tüxen <tuexen@fh-muenster.de>2011-05-19 20:20:35 +0000
committerMichael Tüxen <tuexen@fh-muenster.de>2011-05-19 20:20:35 +0000
commit8b701e108a91fd55413ed7b98072b055180a9bf3 (patch)
treeb4aafd3bd96a0f3b77b94df61f8f2f4041853f42
parentd868d6385bb2ea0bceeabd1f76f8f91ad441c94f (diff)
In case we have no interface information in the array, use the global value.
This fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5935. svn path=/trunk/; revision=37307
-rw-r--r--capture.c9
-rw-r--r--capture_sync.c48
-rw-r--r--gtk/main_statusbar.c6
3 files changed, 59 insertions, 4 deletions
diff --git a/capture.c b/capture.c
index 8631769743..507417a7a6 100644
--- a/capture.c
+++ b/capture.c
@@ -145,10 +145,15 @@ capture_start(capture_options *capture_opts)
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Start ...");
+ if (capture_opts->ifaces->len == 0) {
+ g_string_printf(source, "%s", get_iface_description(capture_opts));
+ if (capture_opts->cfilter && capture_opts->cfilter[0]) {
+ g_string_append_printf(source, " (%s)", capture_opts->cfilter);
+ }
#ifdef _WIN32
- if (capture_opts->ifaces->len < 2) {
+ } else if (capture_opts->ifaces->len < 2) {
#else
- if (capture_opts->ifaces->len < 4) {
+ } else if (capture_opts->ifaces->len < 4) {
#endif
for (i = 0; i < capture_opts->ifaces->len; i++) {
interface_options interface_opts;
diff --git a/capture_sync.c b/capture_sync.c
index c76acb7589..191cd198fd 100644
--- a/capture_sync.c
+++ b/capture_sync.c
@@ -425,6 +425,54 @@ sync_pipe_start(capture_options *capture_opts) {
g_snprintf(sautostop_duration, ARGV_NUMBER_LEN, "duration:%d",capture_opts->autostop_duration);
argv = sync_pipe_add_arg(argv, &argc, sautostop_duration);
}
+ if (capture_opts->ifaces->len == 0) {
+ interface_opts.name = g_strdup(capture_opts->iface);
+ if (capture_opts->iface_descr) {
+ interface_opts.descr = g_strdup(capture_opts->iface_descr);
+ } else {
+ interface_opts.descr = NULL;
+ }
+ interface_opts.cfilter = g_strdup(capture_opts->cfilter);
+ interface_opts.snaplen = capture_opts->snaplen;
+ interface_opts.linktype = capture_opts->linktype;
+ interface_opts.promisc_mode = capture_opts->promisc_mode;
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+ interface_opts.buffer_size = capture_opts->buffer_size;
+#endif
+ interface_opts.monitor_mode = capture_opts->monitor_mode;
+#ifdef HAVE_PCAP_REMOTE
+ interface_opts.src_type = capture_opts->src_type;
+ if (capture_opts->remote_host) {
+ interface_opts.remote_host = g_strdup(capture_opts->remote_host);
+ } else {
+ interface_opts.remote_host = NULL;
+ }
+ if (capture_opts->remote_port) {
+ interface_opts.remote_port = g_strdup(capture_opts->remote_port);
+ } else {
+ interface_opts.remote_port = NULL;
+ }
+ interface_opts.auth_type = capture_opts->auth_type;
+ if (capture_opts->auth_username) {
+ interface_opts.auth_username = g_strdup(capture_opts->auth_username);
+ } else {
+ interface_opts.auth_username = NULL;
+ }
+ if (capture_opts->auth_password) {
+ interface_opts.auth_password = g_strdup(capture_opts->auth_password);
+ } else {
+ interface_opts.auth_password = NULL;
+ }
+ interface_opts.datatx_udp = capture_opts->datatx_udp;
+ interface_opts.nocap_rpcap = capture_opts->nocap_rpcap;
+ interface_opts.nocap_local = capture_opts->nocap_local;
+#endif
+#ifdef HAVE_PCAP_SETSAMPLING
+ interface_opts.sampling_method = capture_opts->sampling_method;
+ interface_opts.sampling_param = capture_opts->sampling_param;
+#endif
+ g_array_append_val(capture_opts->ifaces, interface_opts);
+ }
for (j = 0; j < capture_opts->ifaces->len; j++) {
interface_opts = g_array_index(capture_opts->ifaces, interface_options, j);
diff --git a/gtk/main_statusbar.c b/gtk/main_statusbar.c
index 9e246191f1..ffaea3a928 100644
--- a/gtk/main_statusbar.c
+++ b/gtk/main_statusbar.c
@@ -695,10 +695,12 @@ 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
- if (capture_opts->ifaces->len < 2) {
+ } else if (capture_opts->ifaces->len < 2) {
#else
- if (capture_opts->ifaces->len < 4) {
+ } else if (capture_opts->ifaces->len < 4) {
#endif
for (i = 0; i < capture_opts->ifaces->len; i++) {
if (i > 0) {