Commit aa1a62b1 authored by Eddie Kohler's avatar Eddie Kohler

User FromDevice: METHOD PCAP obeys OUTBOUND true.

Using pcap_setdirection.

Problem report from Antonie Henning and Robert Sombrutzki.
parent 06604a7a
......@@ -34,14 +34,6 @@
of 'madvise', and to 0 if you don't. */
#undef HAVE_DECL_MADVISE
/* Define to 1 if you have the declaration
of 'pcap_inject', and to 0 if you don't. */
#undef HAVE_DECL_PCAP_INJECT
/* Define to 1 if you have the declaration
of 'pcap_sendpacket', and to 0 if you don't. */
#undef HAVE_DECL_PCAP_SENDPACKET
/* Define to 1 if you have the declaration
of 'pcap_setnonblock', and to 0 if you don't. */
#undef HAVE_DECL_PCAP_SETNONBLOCK
......@@ -136,6 +128,9 @@
/* Define if you have the pcap_sendpacket function. */
#undef HAVE_PCAP_SENDPACKET
/* Define if you have the pcap_setdirection function. */
#undef HAVE_PCAP_SETDIRECTION
/* Define if you have the pcap_setnonblock function. */
#undef HAVE_PCAP_SETNONBLOCK
......
......@@ -9710,29 +9710,7 @@ $as_echo "$ac_cv_bpf_timeval" >&6; }
$as_echo "#define HAVE_BPF_TIMEVAL 1" >>confdefs.h
fi
ac_fn_cxx_check_decl "$LINENO" "pcap_inject" "ac_cv_have_decl_pcap_inject" "#include <pcap.h>
"
if test "x$ac_cv_have_decl_pcap_inject" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_PCAP_INJECT $ac_have_decl
_ACEOF
ac_fn_cxx_check_decl "$LINENO" "pcap_sendpacket" "ac_cv_have_decl_pcap_sendpacket" "#include <pcap.h>
"
if test "x$ac_cv_have_decl_pcap_sendpacket" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_PCAP_SENDPACKET $ac_have_decl
_ACEOF
ac_fn_cxx_check_decl "$LINENO" "pcap_setnonblock" "ac_cv_have_decl_pcap_setnonblock" "#include <pcap.h>
ac_fn_cxx_check_decl "$LINENO" "pcap_setnonblock" "ac_cv_have_decl_pcap_setnonblock" "#include <pcap.h>
"
if test "x$ac_cv_have_decl_pcap_setnonblock" = xyes; then :
ac_have_decl=1
......@@ -9891,7 +9869,7 @@ $as_echo "#define HAVE_PCAP 1" >>confdefs.h
saveflags="$LDFLAGS"
LDFLAGS="$saveflags $PCAP_LIBS"
for ac_func in pcap_inject pcap_sendpacket pcap_setnonblock
for ac_func in pcap_inject pcap_sendpacket pcap_setdirection pcap_setnonblock
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
......
......@@ -279,7 +279,9 @@ FromDevice::initialize(ErrorHandler *errh)
_fd = pcap_fileno(_pcap);
char *ifname = _ifname.mutable_c_str();
# ifdef BIOCSSEESENT
# if HAVE_PCAP_SETDIRECTION
pcap_setdirection(_pcap, _outbound ? PCAP_D_INOUT : PCAP_D_IN);
# elif defined(BIOCSSEESENT)
{
int r, accept = _outbound;
if ((r = ioctl(_fd, BIOCSSEESENT, &accept)) == -1)
......
......@@ -309,7 +309,7 @@ AC_DEFUN([CLICK_CHECK_LIBPCAP], [
if test "$ac_cv_bpf_timeval" = yes; then
AC_DEFINE([HAVE_BPF_TIMEVAL], [1], [Define if <pcap.h> uses bpf_timeval.])
fi
AC_CHECK_DECLS([pcap_inject, pcap_sendpacket, pcap_setnonblock], [], [], [#include <pcap.h>])
AC_CHECK_DECLS([pcap_setnonblock], [], [], [#include <pcap.h>])
CPPFLAGS="$saveflags"
fi
......@@ -359,7 +359,7 @@ AC_DEFUN([CLICK_CHECK_LIBPCAP], [
saveflags="$LDFLAGS"
LDFLAGS="$saveflags $PCAP_LIBS"
AC_CHECK_FUNCS([pcap_inject pcap_sendpacket pcap_setnonblock])
AC_CHECK_FUNCS([pcap_inject pcap_sendpacket pcap_setdirection pcap_setnonblock])
LDFLAGS="$saveflags"
fi
])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment