Not all versions of libpcap have "pcap_compile_nopcap()"; use it only if

we have it.

Not all versions of libpcap have DLT_LINUX_SLL, either; use DLT_EN10MB
instead.

svn path=/trunk/; revision=8670
This commit is contained in:
Guy Harris 2003-10-10 21:13:21 +00:00
parent 2699b77d84
commit a3d8b3481f
2 changed files with 8 additions and 6 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.59 2003/10/10 10:12:18 guy Exp $
dnl $Id: acinclude.m4,v 1.60 2003/10/10 21:13:21 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)
AC_CHECK_FUNCS(pcap_findalldevs pcap_lib_version pcap_compile_nopcap)
LIBS="$ac_save_LIBS"
])

View File

@ -1,6 +1,6 @@
/* tethereal.c
*
* $Id: tethereal.c,v 1.201 2003/10/10 13:33:49 jmayer Exp $
* $Id: tethereal.c,v 1.202 2003/10/10 21:13:21 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -793,6 +793,8 @@ main(int argc, char *argv[])
gchar *cf_name = NULL, *rfilter = NULL;
#ifdef HAVE_LIBPCAP
gchar *if_text;
#endif
#ifdef HAVE_PCAP_COMPILE_NOPCAP
struct bpf_program fcode;
#endif
dfilter_t *rfcode = NULL;
@ -1340,10 +1342,10 @@ main(int argc, char *argv[])
if (!dfilter_compile(rfilter, &rfcode)) {
fprintf(stderr, "tethereal: %s\n", dfilter_error_msg);
epan_cleanup();
#ifdef HAVE_LIBPCAP
if (pcap_compile_nopcap(DLT_LINUX_SLL,0, &fcode, rfilter, 0, 0) != -1) {
#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"
" Note: This display filter code looks like a valid capture filter;\n"
" maybe you mixed them up?\n");
}
#endif