diff options
author | Jörg Mayer <jmayer@loplof.de> | 2003-10-11 21:49:56 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2003-10-11 21:49:56 +0000 |
commit | 5d4949f2dd34f761db330f65f5d86671fd0a0e3b (patch) | |
tree | c9510992d2bc63ccc1cabb43a1d34d18bd525185 /capture.c | |
parent | a5158ca96756ba0c4f693e510ff6b23b51612e28 (diff) |
Part 3 of display vs. capture syntax confusion patches: Detect probable
use of display filter syntax where capture filter syntax need to be used
in Ethereal.
svn path=/trunk/; revision=8677
Diffstat (limited to 'capture.c')
-rw-r--r-- | capture.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -1,7 +1,7 @@ /* capture.c * Routines for packet capture windows * - * $Id: capture.c,v 1.211 2003/09/15 23:48:42 guy Exp $ + * $Id: capture.c,v 1.212 2003/10/11 21:49:56 jmayer Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -132,6 +132,7 @@ #endif #include <epan/packet.h> +#include <epan/dfilter/dfilter.h> #include "file.h" #include "capture.h" #include "util.h" @@ -1619,8 +1620,19 @@ capture(gboolean *stats_known, struct pcap_stat *stats) netmask = 0; } if (pcap_compile(pch, &fcode, cfile.cfilter, 1, netmask) < 0) { - snprintf(errmsg, sizeof errmsg, "Unable to parse filter string (%s).", - pcap_geterr(pch)); + dfilter_t *rfcode = NULL; + if (dfilter_compile(cfile.cfilter, &rfcode)) { + snprintf(errmsg, sizeof errmsg, + "Unable to parse capture filter string (%s).\n" + " Interestingly enough, this looks like a valid display filter\n" + " Are you sure you didn't mix them up?", + pcap_geterr(pch)); + dfilter_free(rfcode); + } else { + snprintf(errmsg, sizeof errmsg, + "Unable to parse capture filter string (%s).", + pcap_geterr(pch)); + } goto error; } if (pcap_setfilter(pch, &fcode) < 0) { |