aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Tüxen <tuexen@fh-muenster.de>2011-06-27 19:07:36 +0000
committerMichael Tüxen <tuexen@fh-muenster.de>2011-06-27 19:07:36 +0000
commitdf70b4c15cc10b86c06372b8fef7b46c38d31286 (patch)
tree9eb1ae0d32d89ab838a6f808eb2eaba936a95943
parent710c5d67f7c7c4347aba0f8dd802d87850c88b33 (diff)
Fix the bug reported by Guy. Now
tshark -i en0 icmpp returns a correct error message. svn path=/trunk/; revision=37806
-rw-r--r--capture_sync.c6
-rw-r--r--tshark.c10
2 files changed, 10 insertions, 6 deletions
diff --git a/capture_sync.c b/capture_sync.c
index 310c917994..addb714b7b 100644
--- a/capture_sync.c
+++ b/capture_sync.c
@@ -438,12 +438,6 @@ 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);
diff --git a/tshark.c b/tshark.c
index 5045cf44a8..81b0e64030 100644
--- a/tshark.c
+++ b/tshark.c
@@ -834,6 +834,8 @@ main(int argc, char *argv[])
GLogLevelFlags log_flags;
int optind_initial;
gchar *output_only = NULL;
+ guint i;
+ interface_options interface_opts;
#ifdef HAVE_LIBPCAP
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
@@ -1397,6 +1399,14 @@ main(int argc, char *argv[])
" and with additional command-line arguments");
return 1;
}
+ for (i = 0; i < global_capture_opts.ifaces->len; i++) {
+ interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, i);
+ if (interface_opts.cfilter == NULL) {
+ interface_opts.cfilter = get_args_as_string(argc, argv, optind);
+ global_capture_opts.ifaces = g_array_remove_index(global_capture_opts.ifaces, i);
+ g_array_insert_val(global_capture_opts.ifaces, i, interface_opts);
+ }
+ }
global_capture_opts.default_options.cfilter = get_args_as_string(argc, argv, optind);
#else
capture_option_specified = TRUE;