|
@@ -1,5 +1,5 @@
|
|
|
|
|
|
-dnl $Id: configure.in 1519 2006-07-18 02:51:09Z aturner $
|
|
|
|
|
|
+dnl $Id: configure.in 1578 2006-08-08 04:02:14Z aturner $
|
|
|
|
|
|
AC_INIT(tcpreplay)
|
|
AC_INIT(tcpreplay)
|
|
AC_CONFIG_SRCDIR(src/tcpreplay.c)
|
|
AC_CONFIG_SRCDIR(src/tcpreplay.c)
|
|
@@ -12,7 +12,7 @@ AC_PROG_LIBTOOL
|
|
dnl Set version info here!
|
|
dnl Set version info here!
|
|
MAJOR_VERSION=3
|
|
MAJOR_VERSION=3
|
|
MINOR_VERSION=0
|
|
MINOR_VERSION=0
|
|
-MICRO_VERSION=beta9
|
|
|
|
|
|
+MICRO_VERSION=beta11
|
|
TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
|
|
TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
|
|
|
|
|
|
dnl Release is only used for the RPM spec file
|
|
dnl Release is only used for the RPM spec file
|
|
@@ -119,7 +119,7 @@ AC_FUNC_MALLOC
|
|
AC_FUNC_MEMCMP
|
|
AC_FUNC_MEMCMP
|
|
AC_TYPE_SIGNAL
|
|
AC_TYPE_SIGNAL
|
|
AC_FUNC_VPRINTF
|
|
AC_FUNC_VPRINTF
|
|
-AC_CHECK_FUNCS([gettimeofday ctime memset regcomp strdup strerror strtol strncpy strtoull poll ntohll mmap])
|
|
|
|
|
|
+AC_CHECK_FUNCS([gettimeofday ctime memset regcomp strdup strerror strtol strncpy strtoull poll ntohll mmap snprintf vsnprintf])
|
|
|
|
|
|
dnl Look for strlcpy since some BSD's have it
|
|
dnl Look for strlcpy since some BSD's have it
|
|
AC_CHECK_FUNCS([strlcpy],have_strlcpy=true,have_strlcpy=false)
|
|
AC_CHECK_FUNCS([strlcpy],have_strlcpy=true,have_strlcpy=false)
|
|
@@ -142,10 +142,16 @@ AC_ARG_ENABLE(debug,
|
|
AC_HELP_STRING([--enable-debug], [Enable debugging code and support for the -d option]),
|
|
AC_HELP_STRING([--enable-debug], [Enable debugging code and support for the -d option]),
|
|
[ if test x$enableval = xyes; then
|
|
[ if test x$enableval = xyes; then
|
|
debug=yes
|
|
debug=yes
|
|
- CFLAGS="-ggdb -std=gnu99 -Wall -Wextra -Wfatal-errors -Wno-variadic-macros"
|
|
|
|
|
|
+ # check for gcc 4.0 flags -Wfatal-errors & -Wno-variadic-macros support
|
|
|
|
+ CFLAGS="-ggdb -std=gnu99 -Wall -Wextra -Wfatal-errors -Wno-variadic-macros"
|
|
|
|
+ AC_COMPILE_IFELSE([#include <stdlib.h>
|
|
|
|
+ int main(int argc, char *argv[]) { return(0); }],
|
|
|
|
+ [CFLAGS="-ggdb -std=gnu99 -Wall -Wextra -Wfatal-errors -Wno-variadic-macros"],
|
|
|
|
+ [CFLAGS="-ggdb -std=gnu99 -Wall -Wextra"])
|
|
|
|
+# We may also want to add:
|
|
# -Wformat-security -Wswitch-default -Wunused-paramter -Wpadded"
|
|
# -Wformat-security -Wswitch-default -Wunused-paramter -Wpadded"
|
|
AC_SUBST(debug_flag)
|
|
AC_SUBST(debug_flag)
|
|
- AC_DEFINE([DEBUG], [], [Enable debuggin code and support for the -d option])
|
|
|
|
|
|
+ AC_DEFINE([DEBUG], [1], [Enable debuging code and support for the -d option])
|
|
fi])
|
|
fi])
|
|
|
|
|
|
AC_ARG_ENABLE(pedantic,
|
|
AC_ARG_ENABLE(pedantic,
|
|
@@ -159,7 +165,7 @@ AC_ARG_ENABLE(efence,
|
|
AC_HELP_STRING([--enable-efence], [Enable Electric Fence memory debugger]),
|
|
AC_HELP_STRING([--enable-efence], [Enable Electric Fence memory debugger]),
|
|
[ if test x$enableval = xyes; then
|
|
[ if test x$enableval = xyes; then
|
|
CFLAGS="$CFLAGS -lefence"
|
|
CFLAGS="$CFLAGS -lefence"
|
|
- AC_DEFINE([EFENCE], [], [Enable Electric Fence memory debugger])
|
|
|
|
|
|
+ AC_DEFINE([EFENCE], [1], [Enable Electric Fence memory debugger])
|
|
fi])
|
|
fi])
|
|
|
|
|
|
dnl Enable Gprof
|
|
dnl Enable Gprof
|
|
@@ -172,41 +178,74 @@ AC_ARG_ENABLE(gprof,
|
|
# GPROF requires gdb
|
|
# GPROF requires gdb
|
|
CFLAGS="$CFLAGS -ggdb -pg -fprofile-arcs"
|
|
CFLAGS="$CFLAGS -ggdb -pg -fprofile-arcs"
|
|
fi
|
|
fi
|
|
- AC_DEFINE([GPROF], [], [Enable GNU Profiler])
|
|
|
|
|
|
+ AC_DEFINE([GPROF], [1], [Enable GNU Profiler])
|
|
fi])
|
|
fi])
|
|
|
|
|
|
dnl Use 64bits for packet counters
|
|
dnl Use 64bits for packet counters
|
|
AC_ARG_ENABLE(64bits,
|
|
AC_ARG_ENABLE(64bits,
|
|
AC_HELP_STRING([--enable-64bits], [Use 64bit packet counters]),
|
|
AC_HELP_STRING([--enable-64bits], [Use 64bit packet counters]),
|
|
[ if test x$enableval = xyes; then
|
|
[ if test x$enableval = xyes; then
|
|
- AC_DEFINE([ENABLE_64BITS], [], [Use 64bit packet counters])
|
|
|
|
|
|
+ AC_DEFINE([ENABLE_64BITS], [1], [Use 64bit packet counters])
|
|
AC_MSG_NOTICE([Using u_int64_t for packet counters])
|
|
AC_MSG_NOTICE([Using u_int64_t for packet counters])
|
|
else
|
|
else
|
|
AC_MSG_NOTICE([Using u_int32_t for packet counters])
|
|
AC_MSG_NOTICE([Using u_int32_t for packet counters])
|
|
fi
|
|
fi
|
|
])
|
|
])
|
|
|
|
|
|
|
|
+disable_bpf=no
|
|
|
|
+dnl Turn off *BSD's BPF
|
|
|
|
+AC_ARG_ENABLE(bpf,
|
|
|
|
+ AC_HELP_STRING([--disable-bpf], [Disable BPF for sending packets]),
|
|
|
|
+ [ disable_bpf=yes ])
|
|
|
|
+
|
|
|
|
+disable_pf=no
|
|
|
|
+dnl Turn off Linux's PF_PACKET
|
|
|
|
+AC_ARG_ENABLE(pf,
|
|
|
|
+ AC_HELP_STRING([--disable-pf], [Disable Linux PF_PACKET for sending packets]),
|
|
|
|
+ [ if test x$enableval = xno ; then
|
|
|
|
+ disable_pf=yes
|
|
|
|
+ fi
|
|
|
|
+ ])
|
|
|
|
+
|
|
|
|
+disable_libnet=no
|
|
|
|
+dnl Turn of Libnet
|
|
|
|
+AC_ARG_ENABLE(libnet,
|
|
|
|
+ AC_HELP_STRING([--disable-libnet], [Disable Libnet for sending packets]),
|
|
|
|
+ [ if test x$enableval = xno ; then
|
|
|
|
+ disable_libnet=yes
|
|
|
|
+ fi
|
|
|
|
+ ])
|
|
|
|
+
|
|
|
|
+disable_pcap=no
|
|
|
|
+dnl Turn off pcap for sending
|
|
|
|
+AC_ARG_ENABLE(pcap,
|
|
|
|
+ AC_HELP_STRING([--disable-pcap], [Disable Libpcap for sending packets]),
|
|
|
|
+ [ if test x$enableval = xno ; then
|
|
|
|
+ disable_pcap=yes
|
|
|
|
+ fi
|
|
|
|
+ ])
|
|
|
|
+
|
|
dnl Dynamic link libraries
|
|
dnl Dynamic link libraries
|
|
dynamic_link=no
|
|
dynamic_link=no
|
|
AC_ARG_ENABLE(dynamic-link,
|
|
AC_ARG_ENABLE(dynamic-link,
|
|
AC_HELP_STRING([--enable-dynamic-link], [Dynamically link libraries]),
|
|
AC_HELP_STRING([--enable-dynamic-link], [Dynamically link libraries]),
|
|
[ if test x$enableval = xyes; then
|
|
[ if test x$enableval = xyes; then
|
|
- AC_DEFINE([ENABLE_DYNAMIC_LINK], [], [Enable dynamically linking libs])
|
|
|
|
|
|
+ AC_DEFINE([ENABLE_DYNAMIC_LINK], [1], [Enable dynamically linking libs])
|
|
dynamic_link=yes
|
|
dynamic_link=yes
|
|
fi
|
|
fi
|
|
])
|
|
])
|
|
|
|
|
|
dnl Check for inet_aton and inet_pton
|
|
dnl Check for inet_aton and inet_pton
|
|
AC_CHECK_FUNC(inet_aton,
|
|
AC_CHECK_FUNC(inet_aton,
|
|
- AC_DEFINE([HAVE_INET_ATON], [], [Do we have inet_aton?])
|
|
|
|
|
|
+ AC_DEFINE([HAVE_INET_ATON], [1], [Do we have inet_aton?])
|
|
inet_aton=yes,
|
|
inet_aton=yes,
|
|
inet_aton=no)
|
|
inet_aton=no)
|
|
AC_CHECK_FUNC(inet_pton,
|
|
AC_CHECK_FUNC(inet_pton,
|
|
- AC_DEFINE([HAVE_INET_PTON], [], [Do we have inet_pton?])
|
|
|
|
|
|
+ AC_DEFINE([HAVE_INET_PTON], [1], [Do we have inet_pton?])
|
|
inet_pton=yes,
|
|
inet_pton=yes,
|
|
inet_pton=no)
|
|
inet_pton=no)
|
|
AC_CHECK_FUNC(inet_ntop,
|
|
AC_CHECK_FUNC(inet_ntop,
|
|
- AC_DEFINE([HAVE_INET_NTOP], [], [Do we have inet_ntop?])
|
|
|
|
|
|
+ AC_DEFINE([HAVE_INET_NTOP], [1], [Do we have inet_ntop?])
|
|
inet_ntop=yes,
|
|
inet_ntop=yes,
|
|
inet_ntop=no)
|
|
inet_ntop=no)
|
|
|
|
|
|
@@ -219,7 +258,7 @@ if test "$inet_aton" = "no" ; then
|
|
fi
|
|
fi
|
|
|
|
|
|
AC_CHECK_FUNC(inet_addr,
|
|
AC_CHECK_FUNC(inet_addr,
|
|
- AC_DEFINE([HAVE_INET_ADDR], [], [Do we have inet_addr?])
|
|
|
|
|
|
+ AC_DEFINE([HAVE_INET_ADDR], [1], [Do we have inet_addr?])
|
|
inet_addr=yes,
|
|
inet_addr=yes,
|
|
inet_addr=no)
|
|
inet_addr=no)
|
|
|
|
|
|
@@ -227,142 +266,133 @@ if test x$inet_addr = no ; then
|
|
AC_MSG_ERROR([We need inet_addr. See bug 26])
|
|
AC_MSG_ERROR([We need inet_addr. See bug 26])
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
+dnl Enable flowreplay
|
|
|
|
+flowreplay=no
|
|
|
|
+AC_ARG_ENABLE(flowreplay,
|
|
|
|
+ AC_HELP_STRING([--enable-flowreplay], [Enable building flowreplay (alpha)]),
|
|
|
|
+ [ if test x$enableval = xyes; then
|
|
|
|
+ flowreplay=yes
|
|
|
|
+ AC_DEFINE([ENABLE_FLOWREPLAY], [1], [Enable building flowreplay (alpha)])
|
|
|
|
+ fi])
|
|
|
|
|
|
|
|
+AM_CONDITIONAL(ENABLE_FLOWREPLAY, [test x$flowreplay = xyes])
|
|
|
|
|
|
dnl ##################################################
|
|
dnl ##################################################
|
|
dnl Checks for libnet (shamelessly horked from dsniff)
|
|
dnl Checks for libnet (shamelessly horked from dsniff)
|
|
dnl ##################################################
|
|
dnl ##################################################
|
|
foundnet=no
|
|
foundnet=no
|
|
-trynetdir=/usr/local
|
|
|
|
-AC_MSG_CHECKING(for libnet)
|
|
|
|
-AC_ARG_WITH(libnet,
|
|
|
|
- AC_HELP_STRING([--with-libnet=DIR], [Use libnet in DIR]),
|
|
|
|
- [trynetdir=$withval])
|
|
|
|
-
|
|
|
|
-for testdir in $trynetdir /usr/local /usr ; do
|
|
|
|
- if test -f "${testdir}/include/libnet.h" -a $foundnet = no ; then
|
|
|
|
- LNETINC="${testdir}/include/libnet.h"
|
|
|
|
- LNETINCDIR="$testdir/include"
|
|
|
|
- if test $dynamic_link = yes; then
|
|
|
|
- LNETLIB="-L${testdir}/lib -lnet"
|
|
|
|
- elif test -f "${testdir}/lib64/libnet.a" ; then
|
|
|
|
- LNETLIB="${testdir}/lib64/libnet.a"
|
|
|
|
- else
|
|
|
|
- LNETLIB="${testdir}/lib/libnet.a"
|
|
|
|
- fi
|
|
|
|
- foundnet=$testdir
|
|
|
|
- fi
|
|
|
|
-done
|
|
|
|
|
|
+if test $disable_libnet = no ; then
|
|
|
|
+
|
|
|
|
+ trynetdir=/usr/local
|
|
|
|
+ AC_MSG_CHECKING(for libnet)
|
|
|
|
+ AC_ARG_WITH(libnet,
|
|
|
|
+ AC_HELP_STRING([--with-libnet=DIR], [Use libnet in DIR]),
|
|
|
|
+ [trynetdir=$withval])
|
|
|
|
+
|
|
|
|
+ for testdir in $trynetdir /usr/local /usr ; do
|
|
|
|
+ if test -f "${testdir}/include/libnet.h" -a $foundnet = no ; then
|
|
|
|
+ LNETINC="${testdir}/include/libnet.h"
|
|
|
|
+ LNETINCDIR="$testdir/include"
|
|
|
|
+ if test $dynamic_link = yes; then
|
|
|
|
+ LNETLIB="-L${testdir}/lib -lnet"
|
|
|
|
+ elif test -f "${testdir}/lib64/libnet.a" ; then
|
|
|
|
+ LNETLIB="${testdir}/lib64/libnet.a"
|
|
|
|
+ else
|
|
|
|
+ LNETLIB="${testdir}/lib/libnet.a"
|
|
|
|
+ fi
|
|
|
|
+ foundnet=$testdir
|
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+
|
|
|
|
+ if test $foundnet = no ; then
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+ else
|
|
|
|
+ AC_MSG_RESULT($foundnet)
|
|
|
|
+ AC_DEFINE([HAVE_LIBNET], [1], [Enable libnet support])
|
|
|
|
+ fi
|
|
|
|
|
|
-if test $foundnet = no ; then
|
|
|
|
- AC_MSG_RESULT(no)
|
|
|
|
- AC_ERROR(libnet not found)
|
|
|
|
-else
|
|
|
|
- AC_MSG_RESULT($foundnet)
|
|
|
|
|
|
+ AC_SUBST(LNETINC)
|
|
|
|
+ AC_SUBST(LNETLIB)
|
|
fi
|
|
fi
|
|
|
|
|
|
-AC_SUBST(LNETINC)
|
|
|
|
-AC_SUBST(LNETLIB)
|
|
|
|
|
|
+dnl END OF if $disable_libnet = no ; then
|
|
|
|
|
|
-OLDLIBS="$LIBS"
|
|
|
|
-OLDCFLAGS="$CFLAGS"
|
|
|
|
-LIBS="$LNETLIB"
|
|
|
|
-CFLAGS="$CFLAGS -I$LNETINCDIR"
|
|
|
|
|
|
+if test $foundnet = yes ; then
|
|
|
|
+ OLDLIBS="$LIBS"
|
|
|
|
+ OLDCFLAGS="$CFLAGS"
|
|
|
|
+ LIBS="$LNETLIB"
|
|
|
|
+ CFLAGS="$CFLAGS -I$LNETINCDIR"
|
|
|
|
|
|
-dnl Check to see what version of libnet
|
|
|
|
-dnl this code has been reduced a lot, but probably still could be
|
|
|
|
-dnl reduced quite a bit more if we chose too
|
|
|
|
-AC_MSG_CHECKING(for libnet version)
|
|
|
|
|
|
|
|
-AC_TRY_RUN([
|
|
|
|
|
|
+ dnl Check to see what version of libnet
|
|
|
|
+ dnl this code has been reduced a lot, but probably still could be
|
|
|
|
+ dnl reduced quite a bit more if we chose too
|
|
|
|
+ AC_MSG_CHECKING(for libnet version)
|
|
|
|
+
|
|
|
|
+ AC_TRY_RUN([
|
|
#include <string.h>
|
|
#include <string.h>
|
|
#define LIBNET_LIL_ENDIAN 1
|
|
#define LIBNET_LIL_ENDIAN 1
|
|
#include "$LNETINC"
|
|
#include "$LNETINC"
|
|
#define LIB_TEST "1.0"
|
|
#define LIB_TEST "1.0"
|
|
-/*
|
|
|
|
- * simple proggy to test the version of libnet
|
|
|
|
- * returns zero if it's 1.0.x
|
|
|
|
- * or one otherwise
|
|
|
|
- */
|
|
|
|
-int
|
|
|
|
-main (int argc, char *argv[])
|
|
|
|
-{
|
|
|
|
- if (strncmp(LIB_TEST, LIBNET_VERSION, 3) == 0)
|
|
|
|
- exit(0);
|
|
|
|
- exit(1);
|
|
|
|
-}],
|
|
|
|
- libnet_ver_10=yes
|
|
|
|
- AC_MSG_RESULT(1.0.x),
|
|
|
|
- libnet_ver_10=no,
|
|
|
|
- libnet_ver_10=no
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
-AC_TRY_RUN([
|
|
|
|
|
|
+ /*
|
|
|
|
+ * simple proggy to test the version of libnet
|
|
|
|
+ * returns zero if it's 1.0.x
|
|
|
|
+ * or one otherwise
|
|
|
|
+ */
|
|
|
|
+ int
|
|
|
|
+ main (int argc, char *argv[])
|
|
|
|
+ {
|
|
|
|
+ if (strncmp(LIB_TEST, LIBNET_VERSION, 3) == 0)
|
|
|
|
+ exit(0);
|
|
|
|
+ exit(1);
|
|
|
|
+ }],
|
|
|
|
+ libnet_ver_10=yes
|
|
|
|
+ AC_MSG_RESULT(1.0.x),
|
|
|
|
+ libnet_ver_10=no,
|
|
|
|
+ libnet_ver_10=no
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ AC_TRY_RUN([
|
|
#include <string.h>
|
|
#include <string.h>
|
|
#include "$LNETINC"
|
|
#include "$LNETINC"
|
|
#define LIB_TEST "1.1"
|
|
#define LIB_TEST "1.1"
|
|
-/*
|
|
|
|
- * simple proggy to test the version of libnet
|
|
|
|
- * returns zero if it's 1.0.x
|
|
|
|
- * or one otherwise
|
|
|
|
- */
|
|
|
|
-int
|
|
|
|
-main (int argc, char *argv[])
|
|
|
|
-{
|
|
|
|
- if (strncmp(LIB_TEST, LIBNET_VERSION, 3) == 0)
|
|
|
|
- exit(0);
|
|
|
|
- exit(1);
|
|
|
|
-}],
|
|
|
|
- libnet_ver_11=yes
|
|
|
|
- AC_MSG_RESULT(1.1.x),
|
|
|
|
- libnet_ver_11=no,
|
|
|
|
- libnet_ver_11=no
|
|
|
|
- )
|
|
|
|
|
|
+ /*
|
|
|
|
+ * simple proggy to test the version of libnet
|
|
|
|
+ * returns zero if it's 1.0.x
|
|
|
|
+ * or one otherwise
|
|
|
|
+ */
|
|
|
|
+ int
|
|
|
|
+ main (int argc, char *argv[])
|
|
|
|
+ {
|
|
|
|
+ if (strncmp(LIB_TEST, LIBNET_VERSION, 3) == 0)
|
|
|
|
+ exit(0);
|
|
|
|
+ exit(1);
|
|
|
|
+ }],
|
|
|
|
+ libnet_ver_11=yes
|
|
|
|
+ AC_MSG_RESULT(1.1.x),
|
|
|
|
+ libnet_ver_11=no,
|
|
|
|
+ libnet_ver_11=no
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if test $libnet_ver_10 = no -a $libnet_ver_11 = no ; then
|
|
|
|
+ AC_MSG_RESULT(unknown)
|
|
|
|
+ AC_MSG_ERROR(Unable to determine version of libnet)
|
|
|
|
+ fi
|
|
|
|
|
|
|
|
+ if test $libnet_ver_10 = yes ; then
|
|
|
|
+ AC_MSG_ERROR(Libnet version 1.0.x is no longer supported.
|
|
|
|
+ Please upgrade to 1.1.0 or better)
|
|
|
|
+ fi
|
|
|
|
|
|
-if test $libnet_ver_10 = no -a $libnet_ver_11 = no ; then
|
|
|
|
- AC_MSG_RESULT(unknown)
|
|
|
|
- AC_MSG_ERROR(Unable to determine version of libnet)
|
|
|
|
-fi
|
|
|
|
|
|
|
|
-if test $libnet_ver_10 = yes ; then
|
|
|
|
- AC_MSG_ERROR(Libnet version 1.0.x is no longer supported.
|
|
|
|
- Please upgrade to 1.1.0 or better)
|
|
|
|
-fi
|
|
|
|
|
|
+ dnl restore LIBS & CFLAGS
|
|
|
|
+ LIBS="$OLDLIBS"
|
|
|
|
+ CFLAGS="$OLDCFLAGS"
|
|
|
|
|
|
-AC_MSG_CHECKING([for working libnet_checksum()])
|
|
|
|
-AC_TRY_RUN([
|
|
|
|
-#include <string.h>
|
|
|
|
-#include "$LNETINC"
|
|
|
|
-#define LIB_TEST "1.1.3"
|
|
|
|
-/*
|
|
|
|
- * simple proggy to test the version of libnet
|
|
|
|
- * returns zero if it's < 1.1.3 which has the checksum fix
|
|
|
|
- * or one otherwise
|
|
|
|
- */
|
|
|
|
-int
|
|
|
|
-main (int argc, char *argv[])
|
|
|
|
-{
|
|
|
|
- if (strncmp(LIB_TEST, LIBNET_VERSION, 5) <= 0)
|
|
|
|
- exit(0);
|
|
|
|
- exit(1);
|
|
|
|
-}],
|
|
|
|
- libnet_ver_113=yes,
|
|
|
|
- libnet_ver_113=no,
|
|
|
|
- libnet_ver_113=no
|
|
|
|
- )
|
|
|
|
|
|
+fi
|
|
|
|
|
|
-if test $libnet_ver_113 = no ; then
|
|
|
|
- AC_MSG_RESULT(no)
|
|
|
|
- AC_MSG_WARN([You should upgrade to libnet 1.1.3 or better if you
|
|
|
|
- want to modify packets])
|
|
|
|
-else
|
|
|
|
- AC_MSG_RESULT(yes)
|
|
|
|
-fi
|
|
|
|
-
|
|
|
|
-dnl restore LIBS & CFLAGS
|
|
|
|
-LIBS="$OLDLIBS"
|
|
|
|
-CFLAGS="$OLDCFLAGS"
|
|
|
|
|
|
+dnl END OF if test $foundnet = yes
|
|
|
|
|
|
dnl #####################################################
|
|
dnl #####################################################
|
|
dnl Checks for libpcap
|
|
dnl Checks for libpcap
|
|
@@ -406,6 +436,8 @@ OLDCFLAGS="$CFLAGS"
|
|
LIBS="$LPCAPLIB"
|
|
LIBS="$LPCAPLIB"
|
|
CFLAGS="$CFLAGS -I$LPCAPINCDIR"
|
|
CFLAGS="$CFLAGS -I$LPCAPINCDIR"
|
|
|
|
|
|
|
|
+
|
|
|
|
+have_libnet=no
|
|
dnl Check to see what version of libpcap
|
|
dnl Check to see what version of libpcap
|
|
dnl this code has been reduced a lot, but probably still could be
|
|
dnl this code has been reduced a lot, but probably still could be
|
|
dnl reduced quite a bit more if we chose too
|
|
dnl reduced quite a bit more if we chose too
|
|
@@ -435,6 +467,7 @@ main (int argc, char *argv[])
|
|
libpcap_ver=no
|
|
libpcap_ver=no
|
|
AC_MSG_RESULT(< 0.5),
|
|
AC_MSG_RESULT(< 0.5),
|
|
libpcap_ver=no
|
|
libpcap_ver=no
|
|
|
|
+ AC_MSG_RESULT(< 0.5)
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
@@ -450,42 +483,189 @@ AC_TRY_RUN([
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <string.h>
|
|
#include "$LPCAPINC"
|
|
#include "$LPCAPINC"
|
|
|
|
+
|
|
int
|
|
int
|
|
main(int argc, char *argv[]) {
|
|
main(int argc, char *argv[]) {
|
|
pcap_datalink_val_to_description(1);
|
|
pcap_datalink_val_to_description(1);
|
|
exit(0);
|
|
exit(0);
|
|
-}
|
|
|
|
-],
|
|
|
|
|
|
+}],
|
|
have_dlt_to_desc=yes
|
|
have_dlt_to_desc=yes
|
|
AC_MSG_RESULT(yes),
|
|
AC_MSG_RESULT(yes),
|
|
have_dlt_to_desc=no
|
|
have_dlt_to_desc=no
|
|
AC_MSG_RESULT(no),
|
|
AC_MSG_RESULT(no),
|
|
have_dlt_to_desc=no
|
|
have_dlt_to_desc=no
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
)
|
|
)
|
|
|
|
|
|
if test $have_dlt_to_desc = yes ; then
|
|
if test $have_dlt_to_desc = yes ; then
|
|
- AC_DEFINE([HAVE_DLT_VAL_TO_DESC], [],
|
|
|
|
|
|
+ AC_DEFINE([HAVE_DLT_VAL_TO_DESC], [1],
|
|
[Does libpcap have dlt_val_to_desc?])
|
|
[Does libpcap have dlt_val_to_desc?])
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
+dnl This message is placed here for continuity purposes
|
|
|
|
+dnl but things are really set above in the libnet section
|
|
|
|
+AC_MSG_CHECKING(for libnet packet sending support)
|
|
|
|
+if test $disable_libnet = no -a $foundnet != no ; then
|
|
|
|
+ AC_MSG_RESULT(yes)
|
|
|
|
+ AC_DEFINE([HAVE_LIBNET], [1], [Do we support libnet for sending packets?])
|
|
|
|
+ have_libnet=yes
|
|
|
|
+else
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
+have_pcap_inject=no
|
|
|
|
+dnl Check to see if we've got pcap_inject()
|
|
|
|
+AC_MSG_CHECKING(for pcap_inject sending support)
|
|
|
|
+AC_TRY_COMPILE([
|
|
|
|
+#include <stdio.h>
|
|
|
|
+#include <stdlib.h>
|
|
|
|
+#include <string.h>
|
|
|
|
+#include "$LPCAPINC"
|
|
|
|
+],[
|
|
|
|
+ pcap_t *pcap;
|
|
|
|
+ char *buf;
|
|
|
|
+ pcap_inject(pcap, (void *)buf, 0);
|
|
|
|
+],[
|
|
|
|
+ if test $disable_pcap = no ; then
|
|
|
|
+ AC_DEFINE([HAVE_PCAP_INJECT], [1],
|
|
|
|
+ [Does libpcap have pcap_inject?])
|
|
|
|
+ AC_MSG_RESULT(yes)
|
|
|
|
+ have_pcap_inject=yes
|
|
|
|
+ else
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+ fi
|
|
|
|
+],[
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+])
|
|
|
|
+
|
|
|
|
+have_pcap_sendpacket=no
|
|
|
|
+dnl Check to see if we've got pcap_sendpacket()
|
|
|
|
+AC_MSG_CHECKING(for pcap_sendpacket sending support)
|
|
|
|
+AC_TRY_COMPILE([
|
|
|
|
+#include <stdio.h>
|
|
|
|
+#include <stdlib.h>
|
|
|
|
+#include <string.h>
|
|
|
|
+#include "$LPCAPINC"
|
|
|
|
+],[
|
|
|
|
+ pcap_t *pcap;
|
|
|
|
+ u_char *buf;
|
|
|
|
+ pcap_sendpacket(pcap, buf, 0);
|
|
|
|
+],[
|
|
|
|
+ if test $disable_pcap = no ; then
|
|
|
|
+ AC_DEFINE([HAVE_PCAP_SENDPACKET], [1],
|
|
|
|
+ [Does libpcap have pcap_sendpacket?])
|
|
|
|
+ AC_MSG_RESULT(yes)
|
|
|
|
+ have_pcap_sendpacket=yes
|
|
|
|
+ else
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+ fi
|
|
|
|
+],[
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+])
|
|
|
|
+
|
|
|
|
+have_pf=no
|
|
|
|
+dnl Check for linux PF_PACKET support
|
|
|
|
+AC_MSG_CHECKING(for PF_PACKET socket sending support)
|
|
|
|
+AC_TRY_COMPILE([
|
|
|
|
+#include <sys/socket.h>
|
|
|
|
+#include <netpacket/packet.h>
|
|
|
|
+#include <net/ethernet.h> /* the L2 protocols */
|
|
|
|
+#include <netinet/in.h> /* htons */
|
|
|
|
+],[
|
|
|
|
+ int pf_socket;
|
|
|
|
+ pf_socket = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
|
|
|
|
+],[
|
|
|
|
+ if test $disable_pf = no ; then
|
|
|
|
+ AC_DEFINE([HAVE_PF_PACKET], [1],
|
|
|
|
+ [Do we have Linux PF_PACKET socket support?])
|
|
|
|
+ AC_MSG_RESULT(yes)
|
|
|
|
+ have_pf=yes
|
|
|
|
+ else
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+ fi
|
|
|
|
+],[
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+])
|
|
|
|
+
|
|
|
|
+have_bpf=no
|
|
|
|
+dnl Check for BSD's BPF
|
|
|
|
+AC_MSG_CHECKING(for BPF device sending support)
|
|
|
|
+AC_TRY_RUN([
|
|
|
|
+#include <stdio.h>
|
|
|
|
+#include <stdlib.h>
|
|
|
|
+#include <net/bpf.h>
|
|
|
|
+#include <sys/types.h>
|
|
|
|
+#include <sys/socket.h>
|
|
|
|
+#include <fcntl.h>
|
|
|
|
+#include <sys/time.h>
|
|
|
|
+#include <sys/ioctl.h>
|
|
|
|
+#include <net/bpf.h>
|
|
|
|
+#include <errno.h>
|
|
|
|
+
|
|
|
|
+int
|
|
|
|
+main(int argc, char *argv[]) {
|
|
|
|
+ int fd;
|
|
|
|
+
|
|
|
|
+ fd = open("/dev/bpf0", O_RDONLY, 0);
|
|
|
|
+
|
|
|
|
+ /* if we opened it, we're good */
|
|
|
|
+ if (fd > 1)
|
|
|
|
+ exit(0);
|
|
|
|
+
|
|
|
|
+ /* if we got EBUSY or permission denied it exists, so we're good */
|
|
|
|
+ if (fd < 0 && (errno == EBUSY || errno == 13))
|
|
|
|
+ exit(0);
|
|
|
|
+
|
|
|
|
+ /* else suck, no good */
|
|
|
|
+ exit(-1);
|
|
|
|
+}],
|
|
|
|
+ [
|
|
|
|
+ if test $disable_bpf = no ; then
|
|
|
|
+ AC_DEFINE([HAVE_BPF], [1],
|
|
|
|
+ [Do we have BPF device support?])
|
|
|
|
+ AC_MSG_RESULT(yes)
|
|
|
|
+ have_bpf=yes
|
|
|
|
+ else
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+ fi
|
|
|
|
+ ])
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+dnl Make sure we have a valid packet injection mechanisim
|
|
|
|
+if test $have_bpf = no -a $have_pcap_inject = no -a $have_pcap_sendpacket = no \
|
|
|
|
+ -a $have_libnet = no -a $have_pf = no ; then
|
|
|
|
+ AC_MSG_ERROR([Unable to find a supported method to send packets])
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
+dnl Libpcap support doesn't give us a method to get the hardware address of the
|
|
|
|
+dnl interfaces which prevents us from doing proper filtering to prevent bridging loops
|
|
|
|
+enable_tcpbridge=yes
|
|
|
|
+if test $have_bpf = no -a $have_libnet = no -a $have_pf = no ; then
|
|
|
|
+ AC_MSG_NOTICE([tcpbridge support disabled without BPF, Libnet or Linux PF_PACKET])
|
|
|
|
+ enable_tcpbridge=no
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
+AM_CONDITIONAL(ENABLE_TCPBRIDGE, [test $enable_tcpbridge = yes])
|
|
|
|
+
|
|
dnl Older versions of libpcap are missing some DLT types
|
|
dnl Older versions of libpcap are missing some DLT types
|
|
dnl If doesn't exist, we'll define them in src/common/fakepcap.h
|
|
dnl If doesn't exist, we'll define them in src/common/fakepcap.h
|
|
AC_MSG_CHECKING(for DLT_LINUX_SLL in libpcap)
|
|
AC_MSG_CHECKING(for DLT_LINUX_SLL in libpcap)
|
|
AC_TRY_COMPILE([#include "$LPCAPINC"],
|
|
AC_TRY_COMPILE([#include "$LPCAPINC"],
|
|
[ int foo;
|
|
[ int foo;
|
|
foo = DLT_LINUX_SLL ],
|
|
foo = DLT_LINUX_SLL ],
|
|
- [ AC_DEFINE([HAVE_DLT_LINUX_SLL],
|
|
|
|
- [], [Does pcap.h include a header with DLT_LINUX_SLL?])
|
|
|
|
|
|
+ [ AC_DEFINE([HAVE_DLT_LINUX_SLL], [1],
|
|
|
|
+ [Does pcap.h include a header with DLT_LINUX_SLL?])
|
|
AC_MSG_RESULT(yes)
|
|
AC_MSG_RESULT(yes)
|
|
],
|
|
],
|
|
AC_MSG_RESULT(no)
|
|
AC_MSG_RESULT(no)
|
|
)
|
|
)
|
|
|
|
+
|
|
AC_MSG_CHECKING(for DLT_C_HDLC in libpcap)
|
|
AC_MSG_CHECKING(for DLT_C_HDLC in libpcap)
|
|
AC_TRY_COMPILE([#include "$LPCAPINC"],
|
|
AC_TRY_COMPILE([#include "$LPCAPINC"],
|
|
[ int foo;
|
|
[ int foo;
|
|
foo = DLT_C_HDLC ],
|
|
foo = DLT_C_HDLC ],
|
|
- [ AC_DEFINE([HAVE_DLT_C_HDLC],
|
|
|
|
- [], [Does pcap.h include a header with DLT_C_HDLC?])
|
|
|
|
|
|
+ [ AC_DEFINE([HAVE_DLT_C_HDLC], [1],
|
|
|
|
+ [Does pcap.h include a header with DLT_C_HDLC?])
|
|
AC_MSG_RESULT(yes)
|
|
AC_MSG_RESULT(yes)
|
|
],
|
|
],
|
|
AC_MSG_RESULT(no)
|
|
AC_MSG_RESULT(no)
|
|
@@ -498,7 +678,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
|
|
#include "$PCAP_BPF_H_FILE"],
|
|
#include "$PCAP_BPF_H_FILE"],
|
|
[ int foo;
|
|
[ int foo;
|
|
foo = BPF_MAJOR_VERSION; ],
|
|
foo = BPF_MAJOR_VERSION; ],
|
|
- [ AC_DEFINE([INCLUDE_PCAP_BPF_HEADER], [],
|
|
|
|
|
|
+ [ AC_DEFINE([INCLUDE_PCAP_BPF_HEADER], [1],
|
|
[What is the path (if any) to the pcap-bpf.h
|
|
[What is the path (if any) to the pcap-bpf.h
|
|
header?])
|
|
header?])
|
|
AC_MSG_RESULT(yes)
|
|
AC_MSG_RESULT(yes)
|
|
@@ -523,7 +703,9 @@ AC_ARG_WITH(pcapnav-config,
|
|
if test -x $withval ; then
|
|
if test -x $withval ; then
|
|
pcncfg=$withval
|
|
pcncfg=$withval
|
|
AC_MSG_RESULT($pcncfg)
|
|
AC_MSG_RESULT($pcncfg)
|
|
- else
|
|
|
|
|
|
+ elif test x$withval = xno ; then
|
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
|
+ else
|
|
AC_MSG_RESULT([Can't find pcapnav-config: disabling offset jump feature])
|
|
AC_MSG_RESULT([Can't find pcapnav-config: disabling offset jump feature])
|
|
fi ],
|
|
fi ],
|
|
[ AC_PATH_PROG(pcncfg,[pcapnav-config], [no] ) ]
|
|
[ AC_PATH_PROG(pcncfg,[pcapnav-config], [no] ) ]
|
|
@@ -571,47 +753,12 @@ if test x$libpcapnav_ver = xno ; then
|
|
Please upgrade to version 0.4 or better.
|
|
Please upgrade to version 0.4 or better.
|
|
Disabling offset jump feature.])
|
|
Disabling offset jump feature.])
|
|
else
|
|
else
|
|
- AC_DEFINE([HAVE_PCAPNAV], [], [Do we have libpcapnav?])
|
|
|
|
|
|
+ AC_DEFINE([HAVE_PCAPNAV], [1], [Do we have libpcapnav?])
|
|
fi
|
|
fi
|
|
|
|
|
|
fi # checking pcapnav version
|
|
fi # checking pcapnav version
|
|
|
|
|
|
|
|
|
|
-dnl #####################################################
|
|
|
|
-dnl Checks for libnids
|
|
|
|
-dnl #####################################################
|
|
|
|
-foundnids=no
|
|
|
|
-trynidsdir=/usr/local
|
|
|
|
-AC_MSG_CHECKING(for libnids)
|
|
|
|
-AC_ARG_WITH(libnids,
|
|
|
|
- AC_HELP_STRING([--with-libnids=DIR], [Use libnids in DIR]),
|
|
|
|
- [trynidsdir=$withval])
|
|
|
|
-
|
|
|
|
- for testdir in $trynidsdir /usr/local /usr ; do
|
|
|
|
-
|
|
|
|
- if test -f "${testdir}/include/nids.h" -a $foundnids = no ; then
|
|
|
|
- LNIDSINC="${testdir}/include/nids.h"
|
|
|
|
- LNIDSINCDIR="${testdir}/include"
|
|
|
|
-dnl Libnids by default doesn't build a dynamic library and due to a
|
|
|
|
-dnl bug, won't build one for OS X, so we link to the static
|
|
|
|
-dnl LNIDSLIB="${testdir}/lib -lnids"
|
|
|
|
- LNIDSLIB="${testdir}/lib/libnids.a"
|
|
|
|
- foundnids=$testdir
|
|
|
|
- fi
|
|
|
|
- done
|
|
|
|
-
|
|
|
|
- if test $foundnids = no ; then
|
|
|
|
- AC_MSG_RESULT(no)
|
|
|
|
- AC_MSG_WARN(libnids not found. We won't build flowreplay.)
|
|
|
|
- else
|
|
|
|
- AC_MSG_RESULT($foundnids)
|
|
|
|
- AC_DEFINE([HAVE_LIBNIDS], [], [Do we have libnids?])
|
|
|
|
- fi
|
|
|
|
-
|
|
|
|
-AC_SUBST(LNIDSINC)
|
|
|
|
-AC_SUBST(LNIDSLIB)
|
|
|
|
-AM_CONDITIONAL([HAVE_LIBNIDS], [ test ${foundnids} != no ])
|
|
|
|
-
|
|
|
|
dnl (shamelessly ripped off from libpcap)
|
|
dnl (shamelessly ripped off from libpcap)
|
|
dnl Checks to see if unaligned memory accesses fail
|
|
dnl Checks to see if unaligned memory accesses fail
|
|
dnl
|
|
dnl
|
|
@@ -671,7 +818,7 @@ EOF
|
|
esac])
|
|
esac])
|
|
AC_MSG_RESULT($unaligned_fail)
|
|
AC_MSG_RESULT($unaligned_fail)
|
|
if test $unaligned_fail = yes ; then
|
|
if test $unaligned_fail = yes ; then
|
|
- AC_DEFINE([FORCE_ALIGN],1,[Are we strictly aligned?])
|
|
|
|
|
|
+ AC_DEFINE([FORCE_ALIGN],[1],[Are we strictly aligned?])
|
|
fi
|
|
fi
|
|
|
|
|
|
dnl ##################################################
|
|
dnl ##################################################
|
|
@@ -694,7 +841,7 @@ if test "$td" = "no"; then
|
|
AC_MSG_WARN([Unable to find tcpdump. Please specify --with-tcpdump.
|
|
AC_MSG_WARN([Unable to find tcpdump. Please specify --with-tcpdump.
|
|
Disabling verbose reporting.])
|
|
Disabling verbose reporting.])
|
|
else
|
|
else
|
|
- AC_DEFINE([HAVE_TCPDUMP], [], [Do we have tcpdump?])
|
|
|
|
|
|
+ AC_DEFINE([HAVE_TCPDUMP], [1], [Do we have tcpdump?])
|
|
AC_DEFINE_UNQUOTED(TCPDUMP_BINARY, "$td", [The tcpdump binary initially used])
|
|
AC_DEFINE_UNQUOTED(TCPDUMP_BINARY, "$td", [The tcpdump binary initially used])
|
|
fi
|
|
fi
|
|
|
|
|
|
@@ -738,11 +885,11 @@ case $host in
|
|
AC_MSG_RESULT(Apple OS X)
|
|
AC_MSG_RESULT(Apple OS X)
|
|
;;
|
|
;;
|
|
|
|
|
|
- *-*-openbsd*)
|
|
|
|
- nic1=xl0
|
|
|
|
- nic2=xl0
|
|
|
|
- AC_MSG_RESULT(OpenBSD)
|
|
|
|
- ;;
|
|
|
|
|
|
+ *-*-openbsd*)
|
|
|
|
+ nic1=xl0
|
|
|
|
+ nic2=xl0
|
|
|
|
+ AC_MSG_RESULT(OpenBSD)
|
|
|
|
+ ;;
|
|
|
|
|
|
*)
|
|
*)
|
|
AC_MSG_RESULT([$host is unknown!
|
|
AC_MSG_RESULT([$host is unknown!
|