diff options
author | Guy Harris <guy@alum.mit.edu> | 2006-08-21 23:28:19 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2006-08-21 23:28:19 +0000 |
commit | fde1140905548ed81cdfaa0959194a373df0b27d (patch) | |
tree | 8a582bbb444a991cbaa4240cf078a73c0bc0add3 /capture_loop.c | |
parent | a9469ccb31581ef5598ea5293e12d0141a98a222 (diff) |
Initialize the cfilter field of a capture_opts structure to a null
pointer, so we can determine whether a capture filter has been set or
not.
Use that to check in TShark whether the user specified a filter with
"-f" or not, rather than using the no-longer-set
"capture_filter_specified" variable.
Also, check for multiple "-f" options.
If no capture filter is specified, use a null string, to work around
broken versions of Linux libpcap.
svn path=/trunk/; revision=18989
Diffstat (limited to 'capture_loop.c')
-rw-r--r-- | capture_loop.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/capture_loop.c b/capture_loop.c index 0d62461e67..5957ec2f51 100644 --- a/capture_loop.c +++ b/capture_loop.c @@ -1112,6 +1112,14 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct ld.packet_cb = capture_loop_packet_cb; + /* + * Some older Linux versions of libpcap don't work right without + * a capture filter; if none was specified, use an empty string. + * (Yes, that's a libpcap bug, and has been fixed for a while.) + */ + if (capture_opts->cfilter == NULL) + capture_opts->cfilter = g_strdup(""); + /* We haven't yet gotten the capture statistics. */ *stats_known = FALSE; |