dect
/
libpcap
Archived
13
0
Fork 0

Check for "/dev/bpf"; if we find it, use BPF as the capture mechanism,

and assume it's a cloning device.
This commit is contained in:
guy 2007-06-15 17:55:50 +00:00
parent cf5ea4eeec
commit 4f278d5429
4 changed files with 24 additions and 12 deletions

View File

@ -10,6 +10,9 @@
/* Enable optimizer debugging */ /* Enable optimizer debugging */
#undef BDEBUG #undef BDEBUG
/* define if you have a cloning BPF device */
#undef HAVE_CLONING_BPF
/* define if you have the DAG API */ /* define if you have the DAG API */
#undef HAVE_DAG_API #undef HAVE_DAG_API

12
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 1.135 . # From configure.in Revision: 1.136 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59. # Generated by GNU Autoconf 2.59.
# #
@ -5207,6 +5207,16 @@ echo "$as_me:$LINENO: checking packet capture type" >&5
echo $ECHO_N "checking packet capture type... $ECHO_C" >&6 echo $ECHO_N "checking packet capture type... $ECHO_C" >&6
if test ! -z "$with_pcap" ; then if test ! -z "$with_pcap" ; then
V_PCAP="$withval" V_PCAP="$withval"
elif test -r /dev/bpf ; then
#
# Cloning BPF device.
#
V_PCAP=bpf
cat >>confdefs.h <<\_ACEOF
#define HAVE_CLONING_BPF 1
_ACEOF
elif test -r /dev/bpf0 ; then elif test -r /dev/bpf0 ; then
V_PCAP=bpf V_PCAP=bpf
elif test -r /usr/include/net/pfilt.h ; then elif test -r /usr/include/net/pfilt.h ; then

View File

@ -1,4 +1,4 @@
dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.135 2007-06-11 10:04:24 guy Exp $ (LBL) dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.136 2007-06-15 17:55:50 guy Exp $ (LBL)
dnl dnl
dnl Copyright (c) 1994, 1995, 1996, 1997 dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved. dnl The Regents of the University of California. All rights reserved.
@ -6,7 +6,7 @@ dnl
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl dnl
AC_REVISION($Revision: 1.135 $) AC_REVISION($Revision: 1.136 $)
AC_PREREQ(2.50) AC_PREREQ(2.50)
AC_INIT(pcap.c) AC_INIT(pcap.c)
@ -184,6 +184,12 @@ AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
AC_MSG_CHECKING(packet capture type) AC_MSG_CHECKING(packet capture type)
if test ! -z "$with_pcap" ; then if test ! -z "$with_pcap" ; then
V_PCAP="$withval" V_PCAP="$withval"
elif test -r /dev/bpf ; then
#
# Cloning BPF device.
#
V_PCAP=bpf
AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
elif test -r /dev/bpf0 ; then elif test -r /dev/bpf0 ; then
V_PCAP=bpf V_PCAP=bpf
elif test -r /usr/include/net/pfilt.h ; then elif test -r /usr/include/net/pfilt.h ; then

View File

@ -20,7 +20,7 @@
*/ */
#ifndef lint #ifndef lint
static const char rcsid[] _U_ = static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.98 2007-06-11 10:04:25 guy Exp $ (LBL)"; "@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.99 2007-06-15 17:55:50 guy Exp $ (LBL)";
#endif #endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -35,13 +35,6 @@ static const char rcsid[] _U_ =
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#ifdef HAVE_PATHS_H
#include <paths.h>
#if defined(__NetBSD__) && defined(_PATH_BPF)
#define HAVE_CLONING_BPF
#endif /* __NetBSD__ && _PATH_BPF */
#endif /* HAVE_PATHS_H */
#include <net/if.h> #include <net/if.h>
#ifdef _AIX #ifdef _AIX
@ -531,7 +524,7 @@ bpf_open(pcap_t *p, char *errbuf)
{ {
int fd; int fd;
#ifdef HAVE_CLONING_BPF #ifdef HAVE_CLONING_BPF
static const char device[] = _PATH_BPF; static const char device[] = "/dev/bpf";
#else #else
int n = 0; int n = 0;
char device[sizeof "/dev/bpf0000000000"]; char device[sizeof "/dev/bpf0000000000"];