From 421dafd2def6a7a3b4187c22c936f86ec80d32d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=BCxen?= Date: Mon, 27 Jun 2011 00:09:03 +0000 Subject: 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. svn path=/trunk/; revision=37794 --- capture_sync.c | 65 ++++++++-------------------------------------------------- 1 file changed, 8 insertions(+), 57 deletions(-) (limited to 'capture_sync.c') 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: -- cgit v1.2.3