aboutsummaryrefslogtreecommitdiffstats
path: root/capture_sync.c
diff options
context:
space:
mode:
authortuexen <tuexen@f5534014-38df-0310-8fa8-9805f1628bb7>2011-06-27 00:09:03 +0000
committertuexen <tuexen@f5534014-38df-0310-8fa8-9805f1628bb7>2011-06-27 00:09:03 +0000
commit9d78645e53343caa65978ac7d95525ee715f70bd (patch)
treebb643894194a390b834607109790faa403b74982 /capture_sync.c
parent58316c299a25992d65b7cb598021c254c2cb3acc (diff)
Get rid of old non-interface specific settings which are now interface
specifc. This finalizes the change of the infrastructure. This patch is based on work by Irene Ruengeler. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37794 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'capture_sync.c')
-rw-r--r--capture_sync.c65
1 files changed, 8 insertions, 57 deletions
diff --git a/capture_sync.c b/capture_sync.c
index 0e00856d5f..fbc374bc39 100644
--- a/capture_sync.c
+++ b/capture_sync.c
@@ -361,7 +361,6 @@ 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;
@@ -428,57 +427,6 @@ 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) {
- 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);
- } 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);
- } else {
- no_ifaces = FALSE;
- }
for (j = 0; j < capture_opts->ifaces->len; j++) {
interface_opts = g_array_index(capture_opts->ifaces, interface_options, j);
@@ -490,7 +438,12 @@ sync_pipe_start(capture_options *capture_opts) {
argv = sync_pipe_add_arg(argv, &argc, "-f");
argv = sync_pipe_add_arg(argv, &argc, interface_opts.cfilter);
}
-
+ if (interface_opts.cfilter == NULL &&
+ capture_opts->default_options.cfilter != NULL &&
+ strlen(capture_opts->default_options.cfilter) != 0) {
+ argv = sync_pipe_add_arg(argv, &argc, "-f");
+ argv = sync_pipe_add_arg(argv, &argc, capture_opts->default_options.cfilter);
+ }
if (interface_opts.snaplen != WTAP_MAX_PACKET_SIZE) {
argv = sync_pipe_add_arg(argv, &argc, "-s");
g_snprintf(ssnap, ARGV_NUMBER_LEN, "%d", interface_opts.snaplen);
@@ -547,9 +500,6 @@ 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
@@ -1674,7 +1624,8 @@ sync_pipe_input_cb(gint source, gpointer user_data)
/* (an error message doesn't mean we have to stop capturing) */
break;
case SP_BAD_FILTER:
- capture_input_cfilter_error_message(capture_opts, buffer);
+ /* FIXME: Indicate the correct index */
+ capture_input_cfilter_error_message(capture_opts, 0, buffer);
/* the capture child will close the sync_pipe, nothing to do for now */
break;
case SP_DROPS: