aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-12-18 02:46:45 +0000
committerGuy Harris <guy@alum.mit.edu>2003-12-18 02:46:45 +0000
commit7725f5e92de8e4aef6f5ad650b2ad70044e0b2ea (patch)
tree443fae5c5bed1c326c22477599d5746f51eda89f
parent7f71ceb564e2f74c7e87083e7cfac63f87dba125 (diff)
"pcap_compile_nopcap()" has a different signature in recent NetBSD
libpcap than in tcpdump.org libpcap; it's been deprecated for that reason. "pcap_open_dead()" has been in libpcap since 0.6, so only for 0.5[.x] will you have "pcap_compile_nopcap()" but not "pcap_open_dead()" - for now, we use "pcap_open_dead()" rather than "pcap_compile_nopcap()", and don't do the check for capture filters in systems with libpcaps that lack "pcap_open_dead()". svn path=/trunk/; revision=9341
-rw-r--r--acinclude.m44
-rw-r--r--tethereal.c22
2 files changed, 17 insertions, 9 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 41df396f4c..a4d7ce3754 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2,7 +2,7 @@ dnl Macros that test for specific features.
dnl This file is part of the Autoconf packaging for Ethereal.
dnl Copyright (C) 1998-2000 by Gerald Combs.
dnl
-dnl $Id: acinclude.m4,v 1.65 2003/12/17 02:36:56 guy Exp $
+dnl $Id: acinclude.m4,v 1.66 2003/12/18 02:46:45 guy Exp $
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -352,7 +352,7 @@ and did you also install that package?]]))
else
AC_MSG_RESULT(no)
fi
- AC_CHECK_FUNCS(pcap_findalldevs pcap_lib_version pcap_compile_nopcap)
+ AC_CHECK_FUNCS(pcap_findalldevs pcap_lib_version pcap_open_dead)
AC_CHECK_FUNCS(pcap_datalink_val_to_name pcap_datalink_name_to_val)
AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink)
LIBS="$ac_save_LIBS"
diff --git a/tethereal.c b/tethereal.c
index 64bd1344ec..3a672629b3 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.211 2003/12/17 21:11:25 guy Exp $
+ * $Id: tethereal.c,v 1.212 2003/12/18 02:46:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -804,7 +804,7 @@ main(int argc, char *argv[])
GList *lt_list, *lt_entry;
data_link_info_t *data_link_info;
#endif
-#ifdef HAVE_PCAP_COMPILE_NOPCAP
+#ifdef HAVE_PCAP_OPEN_DEAD
struct bpf_program fcode;
#endif
dfilter_t *rfcode = NULL;
@@ -1429,11 +1429,19 @@ main(int argc, char *argv[])
if (!dfilter_compile(rfilter, &rfcode)) {
fprintf(stderr, "tethereal: %s\n", dfilter_error_msg);
epan_cleanup();
-#ifdef HAVE_PCAP_COMPILE_NOPCAP
- if (pcap_compile_nopcap(DLT_EN10MB, 0, &fcode, rfilter, 0, 0) != -1) {
- fprintf(stderr,
- " Note: This display filter code looks like a valid capture filter;\n"
- " maybe you mixed them up?\n");
+#ifdef HAVE_PCAP_OPEN_DEAD
+ {
+ pcap_t *p;
+
+ p = pcap_open_dead(DLT_EN10MB, MIN_PACKET_SIZE);
+ if (p != NULL) {
+ if (pcap_compile(p, &fcode, rfilter, 0, 0) != -1) {
+ fprintf(stderr,
+ " Note: That display filter code looks like a valid capture filter;\n"
+ " maybe you mixed them up?\n");
+ }
+ pcap_close(p);
+ }
}
#endif
exit(2);