"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
This commit is contained in:
Guy Harris 2003-12-18 02:46:45 +00:00
parent 7f71ceb564
commit 7725f5e92d
2 changed files with 17 additions and 9 deletions

View File

@ -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"

View File

@ -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);