From 7dd8f835a0ce345f841d9eec0eab3a14d5e0d5a5 Mon Sep 17 00:00:00 2001 From: Carsten Grohmann Date: Tue, 19 May 2015 17:55:42 +0200 Subject: [PATCH 1/3] Quote variables and add new TCL versions "8.5" and "8.6" --- configure | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/configure b/configure index dab04ab..047712d 100755 --- a/configure +++ b/configure @@ -44,11 +44,11 @@ if [ ! "$CONFIGOSTYPE" ]; then fi # for BSD/OS use the historical name as it doesn't include '/' -if [ $CONFIGOSTYPE = "BSD/OS" ]; then +if [ "$CONFIGOSTYPE" = "BSD/OS" ]; then CONFIGOSTYPE=BSDI fi -case $CONFIGOSTYPE in +case "$CONFIGOSTYPE" in SUNOS) SOLARISLIB="-lsocket -lresolv -lnsl" BUG='/* #define STUPID_SOLARIS_CHECKSUM_BUG */' @@ -63,31 +63,31 @@ esac # for TCLPATH_TRY in "/usr/bin/" "/usr/local/bin/" "/bin/" do - for TCLVER_TRY in "8.4" "8.3" "8.2" "8.1" "8.0" + for TCLVER_TRY in "8.6" "8.5" "8.4" "8.3" "8.2" "8.1" "8.0" do - if [ -z $TCLSH ] + if [ -z "$TCLSH" ] then - TCLSH_TRY=${TCLPATH_TRY}tclsh${TCLVER_TRY} - if [ -f $TCLSH_TRY ] + TCLSH_TRY="${TCLPATH_TRY}tclsh${TCLVER_TRY}" + if [ -f "$TCLSH_TRY" ] then - TCLSH=$TCLSH_TRY + TCLSH="$TCLSH_TRY" echo "===> Found Tclsh in: $TCLSH" fi fi done done -if [ -f $TCLSH ] +if [ -f "$TCLSH" ] then TCL_VER=`echo puts \\$tcl_version | $TCLSH -` - USE_TCL='-DUSE_TCL' + USE_TCL="-DUSE_TCL" TCL_LIB="-ltcl${TCL_VER}" - if [ -e /usr/include/tcl${TCL_VER} ] + if [ -e "/usr/include/tcl${TCL_VER}" ] then TCL_INC="-I/usr/include/tcl${TCL_VER}" - elif [ -e /usr/include/tcl.h ] + elif [ -e "/usr/include/tcl.h" ] then TCL_INC="" - elif [ -e /usr/local/include/tcl${TCL_VER} ] + elif [ -e "/usr/local/include/tcl${TCL_VER}" ] then TCL_INC="-I/usr/local/include/tcl${TCL_VER}" else From f99a2af324a253aaa10a1b9578a2819764df1ba1 Mon Sep 17 00:00:00 2001 From: Carsten Grohmann Date: Thu, 21 May 2015 20:40:16 +0200 Subject: [PATCH 2/3] Use pcap/bpf.h per default, switch back with configure --no-pcap-bpf --- Makefile.in | 2 +- configure | 7 +++++++ libpcap_stuff.c | 4 ++++ script.c | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 5cccbdd..bebe6b8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -9,7 +9,7 @@ CC= gcc AR=/usr/bin/ar RANLIB=/usr/bin/ranlib -CCOPT= -O2 -Wall @PCAP_INCLUDE@ @TCL_INC@ @USE_TCL@ +CCOPT= -O2 -Wall @PCAP_INCLUDE@ @USE_PCAP_BPF@ @TCL_INC@ @USE_TCL@ DEBUG= -g #uncomment the following if you need libpcap based build under linux #(not raccomanded) diff --git a/configure b/configure index 047712d..b68773f 100755 --- a/configure +++ b/configure @@ -6,6 +6,7 @@ show_help() echo "--help show this help" echo "--no-tcl disable TCL scripting support" echo " even if uid != euid" + echo "--no-pcap-bpf use net/bpf.h instead of pcap/bpf.h" } if [ "$1" = "--help" ]; then @@ -107,6 +108,7 @@ fi # PCAP="PCAP=-lpcap" PCAP_INCLUDE="" +USE_PCAP_BPF="-DUSE_PCAP_BPF" for ARG in $*; do case "$ARG" in @@ -116,6 +118,9 @@ for ARG in $*; do TCL_INC="" TCL_LIB="" ;; + *"--no-pcap-bpf") + USE_PCAP_BPF="" + ;; esac done @@ -123,6 +128,7 @@ echo -------------------------------------- echo system type: $CONFIGOSTYPE echo echo "LIBPCAP : $PCAP" +echo "USE_PCAP_BPF : $USE_PCAP_BPF" echo "PCAP_INCLUDE : $PCAP_INCLUDE" echo "MANPATH : $INSTALL_MANPATH" echo "USE_TCL : $USE_TCL" @@ -136,6 +142,7 @@ echo -------------------------------------- echo creating Makefile... sed -e "s^@PCAP@^$PCAP^g" \ + -e "s^@USE_PCAP_BPF@^$USE_PCAP_BPF^g" \ -e "s^@PCAP_INCLUDE@^$PCAP_INCLUDE^g" \ -e "s^@MANPATH@^$INSTALL_MANPATH^g" \ -e "s^@SOLARISLIB@^$SOLARISLIB^g" \ diff --git a/libpcap_stuff.c b/libpcap_stuff.c index 26f9993..d93fba5 100644 --- a/libpcap_stuff.c +++ b/libpcap_stuff.c @@ -16,7 +16,11 @@ #include #include #include +#ifdef USE_PCAP_BPF +#include +#else #include +#endif #include #include "globals.h" diff --git a/script.c b/script.c index 124370c..1fc21ef 100644 --- a/script.c +++ b/script.c @@ -23,7 +23,11 @@ #include #include +#ifdef USE_PCAP_BPF +#include +#else #include +#endif #include #include "release.h" From 80ee989f4974aea25a7acf50116c6cdcf263739f Mon Sep 17 00:00:00 2001 From: CarstenGrohmann Date: Sun, 7 Jun 2015 19:59:12 +0200 Subject: [PATCH 3/3] Add missing return statement to ars_d_set_data() --- apd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/apd.c b/apd.c index 66584fa..8239b6b 100644 --- a/apd.c +++ b/apd.c @@ -893,6 +893,7 @@ int ars_d_set_data(struct ars_packet *pkt, int layer, char *f, char *v) return -ARS_ERROR; err = ars_push_data(pkt, layer, binary, blen); free(binary); + return err; } else if (strcasecmp(f, "uint32") == 0) { int err; __u32 t, nt;