aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2020-03-12 13:16:24 -0700
committerGuy Harris <guy@alum.mit.edu>2020-03-13 00:05:07 +0000
commit0c889d6f5cfdbf008a345fa3292ee468931ab49a (patch)
tree10a858d36541aa0eb6abd767f1251130bfd1bf95 /tshark.c
parentf77c677f186cae1e687767b7766cfdef62c533a1 (diff)
Require at least libpcap 0.8/WinPcap 3.1.
2004 called, they want their libpcap/WinPcap back. RHEL 6 initially shipped with libpcap 1.0; even old Enterprise(TM) versions of OSes ship with something shinier than 0.7.x these days. This lets us get rid of a bunch of #ifdefs and workaround code for missing APIs. Change-Id: I862cb027418b0a0c0f45a26979acea82f93f833b Reviewed-on: https://code.wireshark.org/review/36383 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/tshark.c b/tshark.c
index d67b0feff0..913ec243ca 100644
--- a/tshark.c
+++ b/tshark.c
@@ -730,9 +730,7 @@ main(int argc, char *argv[])
gchar *volatile cf_name = NULL;
gchar *rfilter = NULL;
gchar *dfilter = NULL;
-#ifdef HAVE_PCAP_OPEN_DEAD
struct bpf_program fcode;
-#endif
dfilter_t *rfcode = NULL;
dfilter_t *dfcode = NULL;
e_prefs *prefs_p;
@@ -1880,25 +1878,21 @@ main(int argc, char *argv[])
if (rfilter != NULL) {
tshark_debug("Compiling read filter: '%s'", rfilter);
if (!dfilter_compile(rfilter, &rfcode, &err_msg)) {
+ pcap_t *pc;
+
cmdarg_err("%s", err_msg);
g_free(err_msg);
epan_cleanup();
extcap_cleanup();
-#ifdef HAVE_PCAP_OPEN_DEAD
- {
- pcap_t *pc;
-
- pc = pcap_open_dead(DLT_EN10MB, MIN_PACKET_SIZE);
- if (pc != NULL) {
- if (pcap_compile(pc, &fcode, rfilter, 0, 0) != -1) {
- cmdarg_err_cont(
- " Note: That read filter code looks like a valid capture filter;\n"
- " maybe you mixed them up?");
- }
- pcap_close(pc);
+ pc = pcap_open_dead(DLT_EN10MB, MIN_PACKET_SIZE);
+ if (pc != NULL) {
+ if (pcap_compile(pc, &fcode, rfilter, 0, 0) != -1) {
+ cmdarg_err_cont(
+ " Note: That read filter code looks like a valid capture filter;\n"
+ " maybe you mixed them up?");
}
+ pcap_close(pc);
}
-#endif
exit_status = INVALID_INTERFACE;
goto clean_exit;
}
@@ -1908,25 +1902,21 @@ main(int argc, char *argv[])
if (dfilter != NULL) {
tshark_debug("Compiling display filter: '%s'", dfilter);
if (!dfilter_compile(dfilter, &dfcode, &err_msg)) {
+ pcap_t *pc;
+
cmdarg_err("%s", err_msg);
g_free(err_msg);
epan_cleanup();
extcap_cleanup();
-#ifdef HAVE_PCAP_OPEN_DEAD
- {
- pcap_t *pc;
-
- pc = pcap_open_dead(DLT_EN10MB, MIN_PACKET_SIZE);
- if (pc != NULL) {
- if (pcap_compile(pc, &fcode, dfilter, 0, 0) != -1) {
- cmdarg_err_cont(
- " Note: That display filter code looks like a valid capture filter;\n"
- " maybe you mixed them up?");
- }
- pcap_close(pc);
+ pc = pcap_open_dead(DLT_EN10MB, MIN_PACKET_SIZE);
+ if (pc != NULL) {
+ if (pcap_compile(pc, &fcode, dfilter, 0, 0) != -1) {
+ cmdarg_err_cont(
+ " Note: That display filter code looks like a valid capture filter;\n"
+ " maybe you mixed them up?");
}
+ pcap_close(pc);
}
-#endif
exit_status = INVALID_FILTER;
goto clean_exit;
}