Browse Source

Import upstream version 3.2.1

Aaron Turner 14 years ago
parent
commit
e05cbc4772
52 changed files with 195 additions and 3917 deletions
  1. 22 6
      aclocal.m4
  2. 32 71
      configure
  3. 3 19
      configure.ac
  4. 13 4
      docs/CHANGELOG
  5. 1 1
      libopts/m4/libopts.m4
  6. 7 28
      src/Makefile.am
  7. 15 76
      src/Makefile.in
  8. 10 17
      src/common/cache.c
  9. 1 1
      src/common/svn_version.c
  10. 11 1
      src/common/utils.c
  11. 7 1
      src/common/utils.h
  12. 10 4
      src/config.h.in
  13. 0 14
      src/flow/Makefile.am
  14. 0 470
      src/flow/Makefile.in
  15. 0 141
      src/flow/flowbuff.c
  16. 0 52
      src/flow/flowbuff.h
  17. 0 144
      src/flow/flowkey.c
  18. 0 53
      src/flow/flowkey.h
  19. 0 291
      src/flow/flownode.c
  20. 0 103
      src/flow/flownode.h
  21. 0 141
      src/flow/flowstate.c
  22. 0 52
      src/flow/flowstate.h
  23. 0 172
      src/flowreplay.1
  24. 0 471
      src/flowreplay.c
  25. 0 75
      src/flowreplay.h
  26. 0 934
      src/flowreplay_opts.c
  27. 0 309
      src/flowreplay_opts.def
  28. 0 198
      src/flowreplay_opts.h
  29. 2 2
      src/tcpbridge.1
  30. 1 1
      src/tcpbridge_opts.c
  31. 1 1
      src/tcpbridge_opts.h
  32. 6 6
      src/tcpedit/plugins/dlt_en10mb/en10mb.c
  33. 2 2
      src/tcpedit/plugins/dlt_hdlc/hdlc.c
  34. 2 4
      src/tcpedit/plugins/dlt_ieee80211/ieee80211.c
  35. 2 2
      src/tcpedit/plugins/dlt_linuxsll/linuxsll.c
  36. 2 2
      src/tcpedit/plugins/dlt_null/null.c
  37. 2 2
      src/tcpedit/plugins/dlt_raw/raw.c
  38. 25 25
      src/tcpedit/tcpedit.c
  39. 1 1
      src/tcpedit/tcpedit_stub.h
  40. 2 2
      src/tcpprep.1
  41. 1 1
      src/tcpprep_opts.c
  42. 1 1
      src/tcpprep_opts.h
  43. 2 2
      src/tcpreplay.1
  44. 1 1
      src/tcpreplay_opts.c
  45. 1 1
      src/tcpreplay_opts.h
  46. 2 2
      src/tcprewrite.1
  47. 1 1
      src/tcprewrite_opts.c
  48. 1 1
      src/tcprewrite_opts.h
  49. 3 6
      tcpreplay.spec.in
  50. 1 1
      test/Makefile.am
  51. 1 1
      test/Makefile.in
  52. BIN
      test/test2.rewrite_vlandel

+ 22 - 6
aclocal.m4

@@ -7498,7 +7498,7 @@ dnl  -*- buffer-read-only: t -*- vi: set ro:
 dnl 
 dnl DO NOT EDIT THIS FILE   (libopts.m4)
 dnl 
-dnl It has been AutoGen-ed  Saturday May  5, 2007 at 12:02:37 PM PDT
+dnl It has been AutoGen-ed  Saturday July 28, 2007 at 01:01:51 PM PDT
 dnl From the definitions    libopts.def
 dnl and the template file   conftest.tpl
 dnl
@@ -7581,7 +7581,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
   # ----------------------------------------------------------------------
   AC_CHECK_LIB(gen, pathfind)
   AC_FUNC_VPRINTF
-  AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr strrchr])
+  AC_CHECK_FUNCS([strsignal mmap canonicalize_file_name snprintf strdup strchr strrchr])
 [  INVOKE_LIBOPTS_MACROS_FIRST_done=yes
 fi]])
 
@@ -7916,14 +7916,30 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS],[
 
 dnl @synopsis  LIBOPTS_CHECK
 dnl
-dnl Time-stamp:        "2006-09-23 19:36:24 bkorb"
-dnl Last Committed:    $Date: 2007-07-19 09:08:39 -0700 (Thu, 19 Jul 2007) $
+dnl Time-stamp:        "2007-07-04 11:41:40 bkorb"
+dnl Last Committed:    $Date: 2007/07/04 20:51:20 $
 dnl
 dnl If autoopts-config works, add the linking information to LIBS.
 dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
 dnl the config tests that the library needs.  Invoke the
 dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
 dnl
+dnl  This file is part of AutoGen.
+dnl  AutoGen copyright (c) 1992-2007 Bruce Korb - all rights reserved
+dnl
+dnl  AutoGen is free software: you can redistribute it and/or modify it
+dnl  under the terms of the GNU General Public License as published by the
+dnl  Free Software Foundation, either version 3 of the License, or
+dnl  (at your option) any later version.
+dnl
+dnl  AutoGen is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+dnl  See the GNU General Public License for more details.
+dnl
+dnl  You should have received a copy of the GNU General Public License along
+dnl  with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl
 dnl Default to system libopts
 dnl
 AC_DEFUN([LIBOPTS_CHECK],[
@@ -8004,13 +8020,13 @@ AC_DEFUN([LIBOPTS_CHECK],[
 # end of AC_DEFUN of LIBOPTS_CHECK]
 ])
 # liboptschk.m4 serial 1 (autogen - 5.7.3)
-dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl copyright (c) 2005 by Bruce Korb - all rights reserved
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl Time-stamp:        "2006-09-23 19:42:31 bkorb"
-dnl Last Committed:    $Date: 2007-07-19 09:08:39 -0700 (Thu, 19 Jul 2007) $
+dnl Last Committed:    $Date: 2007/07/04 20:51:18 $
 
 dnl This file can can be used in projects which are not available under
 dnl the GNU General Public License or the GNU Library General Public

+ 32 - 71
configure

@@ -889,8 +889,6 @@ WORDS_BIGENDIAN_FALSE
 debug_flag
 ENABLE_TCPREPLAY_EDIT_TRUE
 ENABLE_TCPREPLAY_EDIT_FALSE
-ENABLE_FLOWREPLAY_TRUE
-ENABLE_FLOWREPLAY_FALSE
 LNETINC
 LNETLIB
 LPCAPINC
@@ -1531,7 +1529,6 @@ Optional Features:
                           packets
   --enable-tcpreplay-edit Link packet editing code with tcpreplay
   --enable-dynamic-link   Dynamically link libraries
-  --enable-flowreplay     Enable building flowreplay (alpha)
   --enable-libnet         Enable using the libnet 1.1.x library (deprecated)
   --enable-local-libopts  Force using the supplied libopts tearoff code
   --disable-libopts-install
@@ -2082,7 +2079,7 @@ fi
 
 MAJOR_VERSION=3
 MINOR_VERSION=2
-MICRO_VERSION=0
+MICRO_VERSION=1
 TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
 
 TCPREPLAY_RELEASE=1
@@ -4587,7 +4584,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4590 "configure"' > conftest.$ac_ext
+  echo '#line 4587 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7324,11 +7321,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7327: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7324: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7331: \$? = $ac_status" >&5
+   echo "$as_me:7328: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7614,11 +7611,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7617: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7614: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7621: \$? = $ac_status" >&5
+   echo "$as_me:7618: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7718,11 +7715,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7721: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7718: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7725: \$? = $ac_status" >&5
+   echo "$as_me:7722: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -10067,7 +10064,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10070 "configure"
+#line 10067 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10167,7 +10164,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10170 "configure"
+#line 10167 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12587,11 +12584,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12590: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12587: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12594: \$? = $ac_status" >&5
+   echo "$as_me:12591: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -12691,11 +12688,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12694: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12691: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12698: \$? = $ac_status" >&5
+   echo "$as_me:12695: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -14253,11 +14250,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14256: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14253: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14260: \$? = $ac_status" >&5
+   echo "$as_me:14257: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14357,11 +14354,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14360: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14357: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14364: \$? = $ac_status" >&5
+   echo "$as_me:14361: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -16544,11 +16541,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16547: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16544: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16551: \$? = $ac_status" >&5
+   echo "$as_me:16548: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16834,11 +16831,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16837: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16834: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16841: \$? = $ac_status" >&5
+   echo "$as_me:16838: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16938,11 +16935,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16941: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16938: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16945: \$? = $ac_status" >&5
+   echo "$as_me:16942: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -24621,7 +24618,8 @@ fi
 
 
 
-for ac_func in gettimeofday ctime memset regcomp strdup strchr strerror strtol strncpy strtoull poll ntohll mmap snprintf vsnprintf
+
+for ac_func in gettimeofday ctime memset regcomp strdup strchr strerror strtol strncpy strtoull poll ntohll mmap snprintf vsnprintf strsignal
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -25528,12 +25526,6 @@ echo "$as_me: error: We need either inet_ntop or inet_pton" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
-if test "$inet_aton" = "no" ; then
-    { { echo "$as_me:$LINENO: error: We need inet_aton" >&5
-echo "$as_me: error: We need inet_aton" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
 { echo "$as_me:$LINENO: checking for inet_addr" >&5
 echo $ECHO_N "checking for inet_addr... $ECHO_C" >&6; }
 if test "${ac_cv_func_inet_addr+set}" = set; then
@@ -25633,29 +25625,6 @@ echo "$as_me: error: We need inet_addr.  See bug 26" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
-flowreplay=no
-# Check whether --enable-flowreplay was given.
-if test "${enable_flowreplay+set}" = set; then
-  enableval=$enable_flowreplay;  if test x$enableval = xyes; then
-         flowreplay=yes
-
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_FLOWREPLAY 1
-_ACEOF
-
-      fi
-fi
-
-
- if test x$flowreplay = xyes; then
-  ENABLE_FLOWREPLAY_TRUE=
-  ENABLE_FLOWREPLAY_FALSE='#'
-else
-  ENABLE_FLOWREPLAY_TRUE='#'
-  ENABLE_FLOWREPLAY_FALSE=
-fi
-
-
 foundnet=no
 trynetdir=no
 have_libnet=no
@@ -31165,7 +31134,8 @@ done
 
 
 
-for ac_func in mmap canonicalize_file_name snprintf strdup strchr strrchr
+
+for ac_func in strsignal mmap canonicalize_file_name snprintf strdup strchr strrchr
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -35589,7 +35559,8 @@ done
 
 
 
-for ac_func in mmap canonicalize_file_name snprintf strdup strchr strrchr
+
+for ac_func in strsignal mmap canonicalize_file_name snprintf strdup strchr strrchr
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -35689,7 +35660,7 @@ fi
 
 
 
-ac_config_files="$ac_config_files Makefile doxygen.cfg lib/Makefile docs/Makefile src/Makefile src/common/Makefile src/tcpedit/Makefile src/flow/Makefile src/defines.h test/Makefile test/config scripts/Makefile tcpreplay.spec"
+ac_config_files="$ac_config_files Makefile doxygen.cfg lib/Makefile docs/Makefile src/Makefile src/common/Makefile src/tcpedit/Makefile src/defines.h test/Makefile test/config scripts/Makefile tcpreplay.spec"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -35850,13 +35821,6 @@ echo "$as_me: error: conditional \"ENABLE_TCPREPLAY_EDIT\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
-if test -z "${ENABLE_FLOWREPLAY_TRUE}" && test -z "${ENABLE_FLOWREPLAY_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_FLOWREPLAY\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"ENABLE_FLOWREPLAY\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
 if test -z "${ENABLE_TCPDUMP_TRUE}" && test -z "${ENABLE_TCPDUMP_FALSE}"; then
   { { echo "$as_me:$LINENO: error: conditional \"ENABLE_TCPDUMP\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
@@ -36355,7 +36319,6 @@ do
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "src/common/Makefile") CONFIG_FILES="$CONFIG_FILES src/common/Makefile" ;;
     "src/tcpedit/Makefile") CONFIG_FILES="$CONFIG_FILES src/tcpedit/Makefile" ;;
-    "src/flow/Makefile") CONFIG_FILES="$CONFIG_FILES src/flow/Makefile" ;;
     "src/defines.h") CONFIG_FILES="$CONFIG_FILES src/defines.h" ;;
     "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
     "test/config") CONFIG_FILES="$CONFIG_FILES test/config" ;;
@@ -36585,8 +36548,6 @@ WORDS_BIGENDIAN_FALSE!$WORDS_BIGENDIAN_FALSE$ac_delim
 debug_flag!$debug_flag$ac_delim
 ENABLE_TCPREPLAY_EDIT_TRUE!$ENABLE_TCPREPLAY_EDIT_TRUE$ac_delim
 ENABLE_TCPREPLAY_EDIT_FALSE!$ENABLE_TCPREPLAY_EDIT_FALSE$ac_delim
-ENABLE_FLOWREPLAY_TRUE!$ENABLE_FLOWREPLAY_TRUE$ac_delim
-ENABLE_FLOWREPLAY_FALSE!$ENABLE_FLOWREPLAY_FALSE$ac_delim
 LNETINC!$LNETINC$ac_delim
 LNETLIB!$LNETLIB$ac_delim
 LPCAPINC!$LPCAPINC$ac_delim
@@ -36610,7 +36571,7 @@ LIBOPTS_CFLAGS!$LIBOPTS_CFLAGS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 47; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 45; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

+ 3 - 19
configure.ac

@@ -1,5 +1,5 @@
 
-dnl $Id: configure.ac 1892 2007-08-10 03:45:29Z aturner $
+dnl $Id: configure.ac 1922 2007-10-25 18:28:47Z aturner $
 
 AC_INIT(tcpreplay)
 AC_CONFIG_SRCDIR(src/tcpreplay.c)
@@ -11,7 +11,7 @@ AM_WITH_DMALLOC
 dnl Set version info here!
 MAJOR_VERSION=3
 MINOR_VERSION=2
-MICRO_VERSION=0
+MICRO_VERSION=1
 TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
 
 dnl Release is only used for the RPM spec file
@@ -160,7 +160,7 @@ AC_TYPE_SIGNAL
 AC_FUNC_VPRINTF
 AC_CHECK_MEMBERS([struct timeval.tv_sec])
 
-AC_CHECK_FUNCS([gettimeofday ctime memset regcomp strdup strchr strerror strtol strncpy strtoull poll ntohll mmap snprintf vsnprintf])
+AC_CHECK_FUNCS([gettimeofday ctime memset regcomp strdup strchr strerror strtol strncpy strtoull poll ntohll mmap snprintf vsnprintf strsignal])
 
 dnl Look for strlcpy since some BSD's have it
 AC_CHECK_FUNCS([strlcpy],have_strlcpy=true,have_strlcpy=false)
@@ -294,10 +294,6 @@ if test "$inet_ntop" = "no" -a "$inet_pton" = "no" ; then
 	AC_MSG_ERROR([We need either inet_ntop or inet_pton])
 fi
 
-if test "$inet_aton" = "no" ; then
-    AC_MSG_ERROR([We need inet_aton])
-fi
-
 AC_CHECK_FUNC(inet_addr, 
     AC_DEFINE([HAVE_INET_ADDR], [1], [Do we have inet_addr?]) 
     inet_addr=yes, 
@@ -307,17 +303,6 @@ if test x$inet_addr = no ; then
     AC_MSG_ERROR([We need inet_addr.  See bug 26])
 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 Checks for libnet IFF you specify --enable-libnet.
 dnl We no longer by default use libnet unless you tell me to.
@@ -1138,7 +1123,6 @@ AC_OUTPUT([Makefile
            src/Makefile
            src/common/Makefile
            src/tcpedit/Makefile
-           src/flow/Makefile
            src/defines.h
            test/Makefile
            test/config

+ 13 - 4
docs/CHANGELOG

@@ -1,4 +1,13 @@
-$Id: CHANGELOG 1901 2007-08-26 20:05:14Z aturner $
+$Id: CHANGELOG 1924 2007-10-25 19:20:28Z aturner $
+
+10/25/2007: Version 3.2.1
+    - Fix tcprewrite segfault in 'make test' under Linux (#200)
+    - Major performance improvement in tcpprep for large pcaps (#261)
+    - Fix strsignal already defined error under Cygwin/Windows (#199)
+    - Fix compile errors for older versions of GCC (#201)
+    - Remove flowreplay code (#262)
+    - Fix DLT rewrite code causing corrupted ethernet protocol type (#268)
+    - Try to fix inet_aton() issue under Solaris (#260)
 
 08/26/2007: Version 3.2
     - Return a more useful error message when tcpprep fails (#187)
@@ -77,9 +86,9 @@ $Id: CHANGELOG 1901 2007-08-26 20:05:14Z aturner $
 03/22/2007: Version 3.0.beta13
 	- Fixed detection of IPv4 packets in libtcpedit on little-endian boxes (#115, #116)
     - Fixed TCP/UDP checksum calculation on little-endian boxes (#126)
-    - Added -quiet flag to tcpreplay for Lothar (#109)
-    - The –-seed flag should now generate the same IP’s on both little-endian & big-endian boxes (#65)
-    - The -skipl2broadcast flag now works as documented (#112)
+    - Added --quiet flag to tcpreplay for Lothar (#109)
+    - The --seed flag should now generate the same IPs on both little-endian & big-endian boxes (#65)
+    - The --skipl2broadcast flag now works as documented (#112)
     - Adding L2 header for DLT_RAW encapsulated packets now works (#16)
     - Clean up documentation (#66, #75)
     - Start initial support for Win32 port (#110, #111)

+ 1 - 1
libopts/m4/libopts.m4

@@ -85,7 +85,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
   # ----------------------------------------------------------------------
   AC_CHECK_LIB(gen, pathfind)
   AC_FUNC_VPRINTF
-  AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr strrchr])
+  AC_CHECK_FUNCS([strsignal mmap canonicalize_file_name snprintf strdup strchr strrchr])
 [  INVOKE_LIBOPTS_MACROS_FIRST_done=yes
 fi]])
 

+ 7 - 28
src/Makefile.am

@@ -1,5 +1,5 @@
 # $Id: Makefile.am 1632 2007-02-03 18:46:16Z aturner $
-SUBDIRS = common tcpedit flow
+SUBDIRS = common tcpedit
 
 if SYSTEM_STRLCPY
 LIBSTRL =
@@ -7,10 +7,9 @@ else
 LIBSTRL = ../lib/libstrl.a
 endif
 
-manpages: tcpprep.1 tcprewrite.1 tcpreplay.1 flowreplay.1 tcpbridge.1
+manpages: tcpprep.1 tcprewrite.1 tcpreplay.1 tcpbridge.1
 
-autoopts: tcpreplay_opts.c tcprewrite_opts.c \
-	flowreplay_opts.c tcpbridge_opts.c manpages
+autoopts: tcpreplay_opts.c tcprewrite_opts.c tcpbridge_opts.c manpages
 
 
 # Get AutoOpts search path
@@ -30,21 +29,13 @@ tcprewrite.1: tcprewrite_opts.def tcpedit/tcpedit_opts.def
 tcpreplay.1: tcpreplay_opts.def
 	@AUTOGEN@ -T agman1.tpl $(opts_list) --base-name tcpreplay tcpreplay_opts.def
 
-flowreplay.1: flowreplay_opts.def
-	@AUTOGEN@ -T agman1.tpl $(opts_list) --base-name flowreplay flowreplay_opts.def
-
 tcpbridge.1: tcpbridge_opts.def tcpedit/tcpedit_opts.def
 	@AUTOGEN@ -T agman1.tpl $(opts_list) --base-name tcpbridge tcpbridge_opts.def
 
 man_MANS = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1
-EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 flowreplay.1
+EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1
 bin_PROGRAMS = tcpreplay tcpprep tcprewrite tcpbridge
 
-if ENABLE_FLOWREPLAY
-man_MANS += flowreplay.1
-bin_PROGRAMS += flowreplay
-endif
-
 tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPREPLAY
 tcpreplay_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a $(LIBSTRL) \
 		  @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
@@ -73,15 +64,6 @@ tcpprep_opts.h: tcpprep_opts.c
 tcpprep_opts.c: tcpprep_opts.def
 	@AUTOGEN@ tcpprep_opts.def
 
-flowreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DFLOWREPLAY
-flowreplay_LDADD = ./common/libcommon.a $(LIBSTRL) ./flow/libflow.a \
-		  @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
-flowreplay_SOURCES = flowreplay_opts.c flowreplay.c 
-flowreplay_OBJECTS: flowreplay_opts.h
-flowreplay_opts.h: flowreplay_opts.c
-flowreplay_opts.c: flowreplay_opts.def
-	@AUTOGEN@ flowreplay_opts.def
-
 tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPBRIDGE
 tcpbridge_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
 		  $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
@@ -91,13 +73,11 @@ tcpbridge_opts.h: tcpbridge_opts.c
 tcpbridge_opts.c: tcpbridge_opts.def tcpedit/tcpedit_opts.def
 	@AUTOGEN@ $(opts_list) tcpbridge_opts.def
 
-noinst_HEADERS = tcpreplay.h tcpprep.h flowreplay.h bridge.h \
-		 defines.h tree.h \
+noinst_HEADERS = tcpreplay.h tcpprep.h bridge.h defines.h tree.h \
 		 send_packets.h signal_handler.h common.h tcpreplay_opts.h \
 		 tcprewrite.h tcprewrite_opts.h tcpprep_opts.h \
 		 tcpprep_opts.def tcprewrite_opts.def tcpreplay_opts.def \
-		 flowreplay_opts.def tcpbridge_opts.def tcpbridge.h \
-		 flowreplay_opts.h tcpbridge_opts.h tcpr.h
+		 tcpbridge_opts.def tcpbridge.h tcpbridge_opts.h tcpr.h
 
 
 MOSTLYCLEANFILES = *~ *.o
@@ -105,5 +85,4 @@ MOSTLYCLEANFILES = *~ *.o
 MAINTAINERCLEANFILES = Makefile.in tcpreplay_opts.h tcpreplay_opts.c \
 		       tcprewrite_opts.c tcprewrite_opts.h tcpprep_opts.c \
 		       tcpprep_opts.h tcpprep.1 tcpreplay.1 tcprewrite.1 \
-		       flowreplay.1 tcpbridge.1 tcpbridge_opts.h tcpbridge_opts.c \
-			   flowreplay_opts.h flowreplay_opts.c
+		       tcpbridge.1 tcpbridge_opts.h tcpbridge_opts.c

+ 15 - 76
src/Makefile.in

@@ -36,9 +36,7 @@ host_triplet = @host@
 target_triplet = @target@
 @ENABLE_TCPREPLAY_EDIT_TRUE@am__append_1 = -DTCPREPLAY_EDIT
 bin_PROGRAMS = tcpreplay$(EXEEXT) tcpprep$(EXEEXT) tcprewrite$(EXEEXT) \
-	tcpbridge$(EXEEXT) $(am__EXEEXT_1)
-@ENABLE_FLOWREPLAY_TRUE@am__append_2 = flowreplay.1
-@ENABLE_FLOWREPLAY_TRUE@am__append_3 = flowreplay
+	tcpbridge$(EXEEXT)
 subdir = src
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
@@ -50,24 +48,15 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES = defines.h
-@ENABLE_FLOWREPLAY_TRUE@am__EXEEXT_1 = flowreplay$(EXEEXT)
 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
-am_flowreplay_OBJECTS = flowreplay-flowreplay_opts.$(OBJEXT) \
-	flowreplay-flowreplay.$(OBJEXT)
-flowreplay_OBJECTS = $(am_flowreplay_OBJECTS)
-@SYSTEM_STRLCPY_FALSE@am__DEPENDENCIES_1 = ../lib/libstrl.a
-am__DEPENDENCIES_2 =
-flowreplay_DEPENDENCIES = ./common/libcommon.a $(am__DEPENDENCIES_1) \
-	./flow/libflow.a $(am__DEPENDENCIES_2)
-flowreplay_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(flowreplay_CFLAGS) \
-	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
 am_tcpbridge_OBJECTS = tcpbridge-tcpbridge_opts.$(OBJEXT) \
 	tcpbridge-tcpbridge.$(OBJEXT) tcpbridge-bridge.$(OBJEXT) \
 	tcpbridge-send_packets.$(OBJEXT)
 tcpbridge_OBJECTS = $(am_tcpbridge_OBJECTS)
+@SYSTEM_STRLCPY_FALSE@am__DEPENDENCIES_1 = ../lib/libstrl.a
+am__DEPENDENCIES_2 =
 tcpbridge_DEPENDENCIES = ./tcpedit/libtcpedit.a ./common/libcommon.a \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
 tcpbridge_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -111,10 +100,10 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(flowreplay_SOURCES) $(tcpbridge_SOURCES) \
-	$(tcpprep_SOURCES) $(tcpreplay_SOURCES) $(tcprewrite_SOURCES)
-DIST_SOURCES = $(flowreplay_SOURCES) $(tcpbridge_SOURCES) \
-	$(tcpprep_SOURCES) $(tcpreplay_SOURCES) $(tcprewrite_SOURCES)
+SOURCES = $(tcpbridge_SOURCES) $(tcpprep_SOURCES) $(tcpreplay_SOURCES) \
+	$(tcprewrite_SOURCES)
+DIST_SOURCES = $(tcpbridge_SOURCES) $(tcpprep_SOURCES) \
+	$(tcpreplay_SOURCES) $(tcprewrite_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
 	install-dvi-recursive install-exec-recursive \
@@ -264,16 +253,15 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 # $Id: Makefile.am 1632 2007-02-03 18:46:16Z aturner $
-SUBDIRS = common tcpedit flow
+SUBDIRS = common tcpedit
 @SYSTEM_STRLCPY_FALSE@LIBSTRL = ../lib/libstrl.a
 @SYSTEM_STRLCPY_TRUE@LIBSTRL = 
 
 # Get AutoOpts search path
 #opts_list=`find tcpedit -type d -not -regex ".*\.svn.*" -not -regex ".*\.deps.*" -exec echo -n "-L {} " \;`
 opts_list = -L tcpedit $(am__append_1)
-man_MANS = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 \
-	$(am__append_2)
-EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 flowreplay.1
+man_MANS = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1
+EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1
 tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPREPLAY
 tcpreplay_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a $(LIBSTRL) \
 		  @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
@@ -289,30 +277,22 @@ tcpprep_LDADD = ./common/libcommon.a \
 		  $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
 
 tcpprep_SOURCES = tcpprep_opts.c tcpprep.c tree.c 
-flowreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DFLOWREPLAY
-flowreplay_LDADD = ./common/libcommon.a $(LIBSTRL) ./flow/libflow.a \
-		  @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
-
-flowreplay_SOURCES = flowreplay_opts.c flowreplay.c 
 tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPBRIDGE
 tcpbridge_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
 		  $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
 
 tcpbridge_SOURCES = tcpbridge_opts.c tcpbridge.c bridge.c send_packets.c 		
-noinst_HEADERS = tcpreplay.h tcpprep.h flowreplay.h bridge.h \
-		 defines.h tree.h \
+noinst_HEADERS = tcpreplay.h tcpprep.h bridge.h defines.h tree.h \
 		 send_packets.h signal_handler.h common.h tcpreplay_opts.h \
 		 tcprewrite.h tcprewrite_opts.h tcpprep_opts.h \
 		 tcpprep_opts.def tcprewrite_opts.def tcpreplay_opts.def \
-		 flowreplay_opts.def tcpbridge_opts.def tcpbridge.h \
-		 flowreplay_opts.h tcpbridge_opts.h tcpr.h
+		 tcpbridge_opts.def tcpbridge.h tcpbridge_opts.h tcpr.h
 
 MOSTLYCLEANFILES = *~ *.o
 MAINTAINERCLEANFILES = Makefile.in tcpreplay_opts.h tcpreplay_opts.c \
 		       tcprewrite_opts.c tcprewrite_opts.h tcpprep_opts.c \
 		       tcpprep_opts.h tcpprep.1 tcpreplay.1 tcprewrite.1 \
-		       flowreplay.1 tcpbridge.1 tcpbridge_opts.h tcpbridge_opts.c \
-			   flowreplay_opts.h flowreplay_opts.c
+		       tcpbridge.1 tcpbridge_opts.h tcpbridge_opts.c
 
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -395,9 +375,6 @@ clean-binPROGRAMS:
 	  echo " rm -f $$p $$f"; \
 	  rm -f $$p $$f ; \
 	done
-flowreplay$(EXEEXT): $(flowreplay_OBJECTS) $(flowreplay_DEPENDENCIES) 
-	@rm -f flowreplay$(EXEEXT)
-	$(flowreplay_LINK) $(flowreplay_OBJECTS) $(flowreplay_LDADD) $(LIBS)
 tcpbridge$(EXEEXT): $(tcpbridge_OBJECTS) $(tcpbridge_DEPENDENCIES) 
 	@rm -f tcpbridge$(EXEEXT)
 	$(tcpbridge_LINK) $(tcpbridge_OBJECTS) $(tcpbridge_LDADD) $(LIBS)
@@ -417,8 +394,6 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flowreplay-flowreplay.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flowreplay-flowreplay_opts.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpbridge-bridge.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpbridge-send_packets.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpbridge-tcpbridge.Po@am__quote@
@@ -454,34 +429,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
-flowreplay-flowreplay_opts.o: flowreplay_opts.c
-@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flowreplay_CFLAGS) $(CFLAGS) -MT flowreplay-flowreplay_opts.o -MD -MP -MF $(DEPDIR)/flowreplay-flowreplay_opts.Tpo -c -o flowreplay-flowreplay_opts.o `test -f 'flowreplay_opts.c' || echo '$(srcdir)/'`flowreplay_opts.c
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/flowreplay-flowreplay_opts.Tpo $(DEPDIR)/flowreplay-flowreplay_opts.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='flowreplay_opts.c' object='flowreplay-flowreplay_opts.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flowreplay_CFLAGS) $(CFLAGS) -c -o flowreplay-flowreplay_opts.o `test -f 'flowreplay_opts.c' || echo '$(srcdir)/'`flowreplay_opts.c
-
-flowreplay-flowreplay_opts.obj: flowreplay_opts.c
-@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flowreplay_CFLAGS) $(CFLAGS) -MT flowreplay-flowreplay_opts.obj -MD -MP -MF $(DEPDIR)/flowreplay-flowreplay_opts.Tpo -c -o flowreplay-flowreplay_opts.obj `if test -f 'flowreplay_opts.c'; then $(CYGPATH_W) 'flowreplay_opts.c'; else $(CYGPATH_W) '$(srcdir)/flowreplay_opts.c'; fi`
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/flowreplay-flowreplay_opts.Tpo $(DEPDIR)/flowreplay-flowreplay_opts.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='flowreplay_opts.c' object='flowreplay-flowreplay_opts.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flowreplay_CFLAGS) $(CFLAGS) -c -o flowreplay-flowreplay_opts.obj `if test -f 'flowreplay_opts.c'; then $(CYGPATH_W) 'flowreplay_opts.c'; else $(CYGPATH_W) '$(srcdir)/flowreplay_opts.c'; fi`
-
-flowreplay-flowreplay.o: flowreplay.c
-@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flowreplay_CFLAGS) $(CFLAGS) -MT flowreplay-flowreplay.o -MD -MP -MF $(DEPDIR)/flowreplay-flowreplay.Tpo -c -o flowreplay-flowreplay.o `test -f 'flowreplay.c' || echo '$(srcdir)/'`flowreplay.c
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/flowreplay-flowreplay.Tpo $(DEPDIR)/flowreplay-flowreplay.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='flowreplay.c' object='flowreplay-flowreplay.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flowreplay_CFLAGS) $(CFLAGS) -c -o flowreplay-flowreplay.o `test -f 'flowreplay.c' || echo '$(srcdir)/'`flowreplay.c
-
-flowreplay-flowreplay.obj: flowreplay.c
-@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flowreplay_CFLAGS) $(CFLAGS) -MT flowreplay-flowreplay.obj -MD -MP -MF $(DEPDIR)/flowreplay-flowreplay.Tpo -c -o flowreplay-flowreplay.obj `if test -f 'flowreplay.c'; then $(CYGPATH_W) 'flowreplay.c'; else $(CYGPATH_W) '$(srcdir)/flowreplay.c'; fi`
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/flowreplay-flowreplay.Tpo $(DEPDIR)/flowreplay-flowreplay.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='flowreplay.c' object='flowreplay-flowreplay.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(flowreplay_CFLAGS) $(CFLAGS) -c -o flowreplay-flowreplay.obj `if test -f 'flowreplay.c'; then $(CYGPATH_W) 'flowreplay.c'; else $(CYGPATH_W) '$(srcdir)/flowreplay.c'; fi`
-
 tcpbridge-tcpbridge_opts.o: tcpbridge_opts.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpbridge_CFLAGS) $(CFLAGS) -MT tcpbridge-tcpbridge_opts.o -MD -MP -MF $(DEPDIR)/tcpbridge-tcpbridge_opts.Tpo -c -o tcpbridge-tcpbridge_opts.o `test -f 'tcpbridge_opts.c' || echo '$(srcdir)/'`tcpbridge_opts.c
 @am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpbridge-tcpbridge_opts.Tpo $(DEPDIR)/tcpbridge-tcpbridge_opts.Po
@@ -1004,10 +951,9 @@ uninstall-man: uninstall-man1
 	uninstall-man1
 
 
-manpages: tcpprep.1 tcprewrite.1 tcpreplay.1 flowreplay.1 tcpbridge.1
+manpages: tcpprep.1 tcprewrite.1 tcpreplay.1 tcpbridge.1
 
-autoopts: tcpreplay_opts.c tcprewrite_opts.c \
-	flowreplay_opts.c tcpbridge_opts.c manpages
+autoopts: tcpreplay_opts.c tcprewrite_opts.c tcpbridge_opts.c manpages
 
 tcpprep.1: tcpprep_opts.def
 	@AUTOGEN@ -T agman1.tpl $(opts_list) --base-name tcpprep tcpprep_opts.def
@@ -1018,9 +964,6 @@ tcprewrite.1: tcprewrite_opts.def tcpedit/tcpedit_opts.def
 tcpreplay.1: tcpreplay_opts.def
 	@AUTOGEN@ -T agman1.tpl $(opts_list) --base-name tcpreplay tcpreplay_opts.def
 
-flowreplay.1: flowreplay_opts.def
-	@AUTOGEN@ -T agman1.tpl $(opts_list) --base-name flowreplay flowreplay_opts.def
-
 tcpbridge.1: tcpbridge_opts.def tcpedit/tcpedit_opts.def
 	@AUTOGEN@ -T agman1.tpl $(opts_list) --base-name tcpbridge tcpbridge_opts.def
 tcpreplay_OBJECTS: tcpreplay_opts.h
@@ -1035,10 +978,6 @@ tcpprep_OBJECTS: tcpprep_opts.h
 tcpprep_opts.h: tcpprep_opts.c
 tcpprep_opts.c: tcpprep_opts.def
 	@AUTOGEN@ tcpprep_opts.def
-flowreplay_OBJECTS: flowreplay_opts.h
-flowreplay_opts.h: flowreplay_opts.c
-flowreplay_opts.c: flowreplay_opts.def
-	@AUTOGEN@ flowreplay_opts.def
 tcpbridge_OBJECTS: tcpbridge_opts.h
 tcpbridge_opts.h: tcpbridge_opts.c
 tcpbridge_opts.c: tcpbridge_opts.def tcpedit/tcpedit_opts.def

+ 10 - 17
src/common/cache.c

@@ -1,4 +1,4 @@
-/* $Id: cache.c 1897 2007-08-25 04:57:38Z aturner $ */
+/* $Id: cache.c 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2001-2005 Aaron Turner.
@@ -256,7 +256,7 @@ new_cache(void)
 tcpr_dir_t
 add_cache(tcpr_cache_t ** cachedata, const int send, const tcpr_dir_t interface)
 {
-    tcpr_cache_t *lastcache = NULL;
+    static tcpr_cache_t *lastcache = NULL;
     u_char *byte = NULL;
     u_int32_t bit;
     tcpr_dir_t result = TCPR_DIR_ERROR;
@@ -273,12 +273,6 @@ add_cache(tcpr_cache_t ** cachedata, const int send, const tcpr_dir_t interface)
         lastcache = *cachedata;
     }
     else {
-        lastcache = *cachedata;
-        /* existing cache, go to last entry */
-        while (lastcache->next != NULL) {
-            lastcache = lastcache->next;
-        }
-
         /* check to see if this is the last bit in this struct */
         if ((lastcache->packets + 1) > (CACHEDATASIZE * CACHE_PACKETS_PER_BYTE)) {
             /*
@@ -317,18 +311,15 @@ add_cache(tcpr_cache_t ** cachedata, const int send, const tcpr_dir_t interface)
             dbgx(2, "don't set interface bit: byte " COUNTER_SPEC " = 0x%x", index, *byte);
             result = TCPR_DIR_S2C;
         }
-        dbgx(3, "Current cache byte: %c%c%c%c%c%c%c%c",
 
-            /* 
-             * only build the byte string when not in debug mode since
-             * the calculation is a bit expensive
-             */
 #ifdef DEBUG
-            BIT_STR(byte2bits(*byte, bitstring))
-#else
-            EIGHT_ZEROS
+        /* 
+         * only build the byte string when not in debug mode since
+         * the calculation is a bit expensive
+         */
+        dbgx(3, "Current cache byte: %c%c%c%c%c%c%c%c",
+            BIT_STR(byte2bits(*byte, bitstring)));
 #endif
-            );
     }
     else {
         dbg(1, "not setting send bit");
@@ -357,8 +348,10 @@ check_cache(char *cachedata, COUNTER packetid)
     bit = (u_int32_t)(((packetid - 1) % (COUNTER)CACHE_PACKETS_PER_BYTE) * 
         (COUNTER)CACHE_BITS_PER_PACKET) + 1;
 
+#ifdef DEBUG
     dbgx(3, "Index: " COUNTER_SPEC "\tBit: %d\tByte: %hhu\tMask: %hhu", index, bit,
         cachedata[index], (cachedata[index] & (char)(1 << bit)));
+#endif
 
     if (!(cachedata[index] & (char)(1 << bit))) {
         return TCPR_DIR_NOSEND;

+ 1 - 1
src/common/svn_version.c

@@ -1,4 +1,4 @@
-const char SVN_Version[] = "1902";
+const char SVN_Version[] = "1925";
 const char *svn_version(void) {
 	return SVN_Version;
 }

+ 11 - 1
src/common/utils.c

@@ -1,4 +1,4 @@
-/* $Id: utils.c 1897 2007-08-25 04:57:38Z aturner $ */
+/* $Id: utils.c 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2001-2005 Aaron Turner.
@@ -236,6 +236,16 @@ argv_create(char *p, int argc, char *argv[])
     return (i);
 }
 
+#ifdef USE_CUSTOM_INET_ATON
+int
+inet_aton(const char *name, struct in_addr *addr)
+{
+    in_addr_t a = inet_addr (name);
+    addr->s_addr = a;
+    return a != (in_addr_t)-1;
+}
+#endif
+
 /*
  Local Variables:
  mode:c

+ 7 - 1
src/common/utils.h

@@ -1,4 +1,4 @@
-/* $Id: utils.h 1893 2007-08-10 04:24:50Z aturner $ */
+/* $Id: utils.h 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2001-2005 Aaron Turner.
@@ -58,6 +58,12 @@ void _our_safe_free(void *ptr, const char *, const int, const char *);
 
 #define MAX_ARGS 128
 
+#ifndef HAVE_INET_ATON
+#define HAVE_INET_ATON
+#define USE_CUSTOM_INET_ATON
+int inet_aton(const char *name, struct in_addr *addr);
+#endif
+
 #endif
 
 /*

+ 10 - 4
src/config.h.in

@@ -1,4 +1,4 @@
-/* src/config.h.in.  Generated from configure.in by autoheader.  */
+/* src/config.h.in.  Generated from configure.ac by autoheader.  */
 
 /* Enable debuging code and support for the -d option */
 #undef DEBUG
@@ -12,9 +12,6 @@
 /* Enable dynamically linking libs */
 #undef ENABLE_DYNAMIC_LINK
 
-/* Enable building flowreplay (alpha) */
-#undef ENABLE_FLOWREPLAY
-
 /* Enable use of pcap_findalldevs() */
 #undef ENABLE_PCAP_FINDALLDEVS
 
@@ -251,6 +248,9 @@
 /* Define to 1 if you have the `strrchr' function. */
 #undef HAVE_STRRCHR
 
+/* Define to 1 if you have the `strsignal' function. */
+#undef HAVE_STRSIGNAL
+
 /* Define to 1 if you have the `strtol' function. */
 #undef HAVE_STRTOL
 
@@ -260,6 +260,9 @@
 /* Define to 1 if `tv_sec' is member of `struct timeval'. */
 #undef HAVE_STRUCT_TIMEVAL_TV_SEC
 
+/* Define to 1 if you have the <sysexits.h> header file. */
+#undef HAVE_SYSEXITS_H
+
 /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
    */
 #undef HAVE_SYS_DIR_H
@@ -363,6 +366,9 @@
    <sysmacros.h>. */
 #undef MAJOR_IN_SYSMACROS
 
+/* Define this if optional arguments are disallowed */
+#undef NO_OPTIONAL_OPT_ARGS
+
 /* This is our package name */
 #undef PACKAGE
 

+ 0 - 14
src/flow/Makefile.am

@@ -1,14 +0,0 @@
-# $Id: Makefile.am 1472 2006-06-11 23:14:48Z aturner $
-noinst_LIBRARIES = libflow.a
-
-libflow_a_SOURCES = flownode.c flowstate.c flowbuff.c flowkey.c
-
-AM_CFLAGS = -I.. -I../.. $(LNAV_CFLAGS) $(LIBOPTS_CFLAGS)
-
-libflow_a_LIBADD = ../../lib/libstrl.a
-
-noinst_HEADERS = flownode.h flowstate.h flowbuff.h flowkey.h
-
-MOSTLYCLEANFILES = *~
-
-MAINTAINERCLEANFILES = Makefile.in 

+ 0 - 470
src/flow/Makefile.in

@@ -1,470 +0,0 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = src/flow
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libflow_a_AR = $(AR) $(ARFLAGS)
-libflow_a_DEPENDENCIES = ../../lib/libstrl.a
-am_libflow_a_OBJECTS = flownode.$(OBJEXT) flowstate.$(OBJEXT) \
-	flowbuff.$(OBJEXT) flowkey.$(OBJEXT)
-libflow_a_OBJECTS = $(am_libflow_a_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
-depcomp = $(SHELL) $(top_srcdir)/config/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(libflow_a_SOURCES)
-DIST_SOURCES = $(libflow_a_SOURCES)
-HEADERS = $(noinst_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOGEN = @AUTOGEN@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-ECHO = @ECHO@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
-LIBOPTS_DIR = @LIBOPTS_DIR@
-LIBOPTS_LDADD = @LIBOPTS_LDADD@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LNAVLIB = @LNAVLIB@
-LNAV_CFLAGS = @LNAV_CFLAGS@
-LNETINC = @LNETINC@
-LNETLIB = @LNETLIB@
-LN_S = @LN_S@
-LPCAPINC = @LPCAPINC@
-LPCAPLIB = @LPCAPLIB@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PCAP_BPF_H_FILE = @PCAP_BPF_H_FILE@
-PRINTF = @PRINTF@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-TCPREPLAY_RELEASE = @TCPREPLAY_RELEASE@
-TCPREPLAY_VERSION = @TCPREPLAY_VERSION@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-debug_flag = @debug_flag@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-nic1 = @nic1@
-nic2 = @nic2@
-oldincludedir = @oldincludedir@
-pcncfg = @pcncfg@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
-tcpdump_path = @tcpdump_path@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-
-# $Id: Makefile.am 1472 2006-06-11 23:14:48Z aturner $
-noinst_LIBRARIES = libflow.a
-libflow_a_SOURCES = flownode.c flowstate.c flowbuff.c flowkey.c
-AM_CFLAGS = -I.. -I../.. $(LNAV_CFLAGS) $(LIBOPTS_CFLAGS)
-libflow_a_LIBADD = ../../lib/libstrl.a
-noinst_HEADERS = flownode.h flowstate.h flowbuff.h flowkey.h
-MOSTLYCLEANFILES = *~
-MAINTAINERCLEANFILES = Makefile.in 
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/flow/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/flow/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-clean-noinstLIBRARIES:
-	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libflow.a: $(libflow_a_OBJECTS) $(libflow_a_DEPENDENCIES) 
-	-rm -f libflow.a
-	$(libflow_a_AR) libflow.a $(libflow_a_OBJECTS) $(libflow_a_LIBADD)
-	$(RANLIB) libflow.a
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flowbuff.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flowkey.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flownode.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flowstate.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-	-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
-	mostlyclean-am
-
-distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES ctags distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am tags uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:

+ 0 - 141
src/flow/flowbuff.c

@@ -1,141 +0,0 @@
-/* $Id: flowbuff.c 1542 2006-07-29 06:19:22Z aturner $ */
-
-/*
- * Copyright (c) 2001-2004 Aaron Turner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright owners nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "defines.h"
-#include "common.h"
-
-#include <stdlib.h>             /* malloc/free */
-#include <string.h>
-
-#include "flowreplay.h"
-#include "flownode.h"
-
-extern flowreplay_opt_t options;
-
-/*
- * adds a packet read from pcap_next() to the chain of buffered
- * packets for the given node.  Mallocs memory. Returns a ptr to 
- * the new buffer or NULL on fail
- */
-struct pktbuffhdr_t *
-addpkt2buff(struct session_t *node, u_char *pktdata, u_int32_t len)
-{
-    struct pktbuffhdr_t *buffhdr = NULL;    /* packet buffer hdr */
-
-    /* check per node buffer limit */
-    if ((node->buffmem + len) > options.pernodebufflim) {
-        warn("Unable to buffer next packet: per node buffer limit reached");
-        return (NULL);
-    }
-
-    /* check total buffer limit */
-    if (options.totalbufflim < len) {
-        warn("Unable to buffer next packet: total buffer limit reached");
-        return (NULL);
-    }
-    /* we got enough buffer space so, mark it off */
-    options.totalbufflim -= len;
-
-    /* prep the buffer header for the linked list */
-    buffhdr = (struct pktbuffhdr_t *)safe_malloc(sizeof(struct pktbuffhdr_t));
-
-    buffhdr->len = len;
-
-    /* allocate memory for the packet data */
-    buffhdr->packet = (u_char *)safe_malloc(len);
-
-    /* copy over the packet */
-    memcpy(buffhdr->packet, pktdata, len);
-
-    /* is this the first packet ? */
-    if (node->lastbuff == NULL) {
-        /* start the chain by pointing both buffered and lastbuff to the new buffer */
-        node->buffered = buffhdr;
-        node->lastbuff = buffhdr;
-    }
-    else {
-        /* otherwise add the buffer to the end of the list */
-        node->lastbuff->next = buffhdr;
-        node->lastbuff = buffhdr;
-    }
-
-    /* return a ptr to the packet */
-    return (buffhdr);
-}
-
-
-/* 
- * frees the last sent packet, relinks the linked list, and returns a
- * pointer to the packet.  packet len is returned in len.  Returns
- * NULL/len = 0 when last packet is reached.
- */
-const u_char *
-nextbuffpkt(struct session_t *node, u_int32_t len)
-{
-    struct pktbuffhdr_t *packet = NULL;
-
-    /* mode temp ptr to next packet, which may be NULL */
-    packet = node->sentbuff->next;
-
-    /* first thing first, free the last packet, update the node's
-     * buffmem counter, the total buffer limit, and free the buffer header
-     */
-    if (node->sentbuff != NULL) {
-        safe_free(node->sentbuff->packet);
-        node->buffmem -= node->sentbuff->len;
-        options.totalbufflim += len;
-        safe_free(node->sentbuff);
-    }
-
-    /* relink the list */
-    node->buffered = packet;
-
-    /* was that the last packet ? */
-    if (node->buffered == NULL) {
-        len = 0;
-        return (NULL);
-    }
-
-    /* otherwise we've got another packet, so update len and return it */
-    len = node->buffered->len;
-    return (node->buffered->packet);
-}
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-

+ 0 - 52
src/flow/flowbuff.h

@@ -1,52 +0,0 @@
-/* $Id: flowbuff.h 1477 2006-07-08 03:54:51Z aturner $ */
-
-/*
- * Copyright (c) 2001-2004 Aaron Turner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright owners nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __FLOWBUFF_H__
-#define __FLOWBUFF_H__
-
-#define PER_NODE_BUFF_LIMIT (1024 * 1024)   /* 1 MB */
-#define TOTAL_BUFF_LIMIT (1024 * 1024 * 25) /* 25 MB */
-
-struct pktbuffhdr_t *addpkt2buff(struct session_t *, u_char *, u_int32_t);
-const u_char *nextbuffpkt(struct session_t *, u_int32_t);
-
-#endif
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-
-

+ 0 - 144
src/flow/flowkey.c

@@ -1,144 +0,0 @@
-/* $Id: flowkey.c 1542 2006-07-29 06:19:22Z aturner $ */
-
-/*
- * Copyright (c) 2001-2004 Aaron Turner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright owners nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "defines.h"
-#include "common.h"
-
-#include "flowreplay.h"
-#include "flowkey.h"
-
-#include <string.h>
-
-
-/*
- * takes in a packet from the IP header on, and generates a unique key
- * for the redblack tree. Uses the following formula:
- * char key[12] = highip + lowip + highport + lowport
- * returns 1 on success, 0 on fail
- */
-int
-rbkeygen(ipv4_hdr_t * ip, u_char proto, void *l4, u_char * key)
-{
-    tcp_hdr_t *tcp = NULL;
-    udp_hdr_t *udp = NULL;
-
-    /* copy over the IP addresses, high then low */
-    if (ip->ip_src.s_addr > ip->ip_dst.s_addr) {
-        memcpy(key, &ip->ip_src.s_addr, 4);
-        memcpy(&key[4], &ip->ip_dst.s_addr, 4);
-    }
-    else {
-        memcpy(key, &ip->ip_dst.s_addr, 4);
-        memcpy(&key[4], &ip->ip_src.s_addr, 4);
-    }
-
-    /* copy over the port, high then low */
-    if (proto == IPPROTO_TCP) {
-        tcp = (tcp_hdr_t *) l4;
-        if (tcp->th_sport > tcp->th_dport) {
-            memcpy(&key[8], &tcp->th_sport, 2);
-            memcpy(&key[10], &tcp->th_dport, 2);
-        }
-        else {
-            memcpy(&key[8], &tcp->th_dport, 2);
-            memcpy(&key[10], &tcp->th_sport, 2);
-        }
-
-        dbgx(3, "rbkeygen TCP: %s:%hu > %s:%hu => 0x%llx",
-            get_addr2name4(ip->ip_src.s_addr, RESOLVE),
-            ntohs(tcp->th_sport),
-            get_addr2name4(ip->ip_dst.s_addr, RESOLVE),
-            ntohs(tcp->th_dport), pkeygen(key));
-
-    }
-    else if (proto == IPPROTO_UDP) {
-        udp = (udp_hdr_t *) l4;
-        if (udp->uh_sport > udp->uh_dport) {
-            memcpy(&key[8], &udp->uh_sport, 2);
-            memcpy(&key[10], &udp->uh_dport, 2);
-        }
-        else {
-            memcpy(&key[8], &udp->uh_dport, 2);
-            memcpy(&key[10], &udp->uh_sport, 2);
-        }
-
-        dbgx(3, "rbkeygen UDP: %s:%u > %s:%u => 0x%llx",
-            get_addr2name4(ip->ip_src.s_addr, RESOLVE),
-            ntohs(udp->uh_sport),
-            get_addr2name4(ip->ip_dst.s_addr, RESOLVE),
-            ntohs(udp->uh_dport), pkeygen(key));
-
-    }
-    else {
-        warn("You tried to rbkeygen() for a non-TCP/UDP packet!");
-        return (0);
-    }
-
-    return (1);
-
-}
-
-/*
- * pseudo-key gen.  Generates a 64bit key suitable for printing via 0x%llx
- * since we can't print the real 12 byte rbkey
- */
-
-u_int64_t
-pkeygen(u_char key[])
-{
-    u_int32_t ip1, ip2;
-    u_int16_t port1, port2;
-    u_int64_t result = 0, temp = 0;
-
-    memcpy(&ip1, &key, 4);
-    memcpy(&ip2, &key[4], 4);
-    memcpy(&port1, &key[8], 2);
-    memcpy(&port2, &key[10], 2);
-
-    result = ip1 ^ ip2;
-
-    temp = (port1 << 16) | port2;
-
-    result = (temp << 32) | result;
-
-    return (result);
-}
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-

+ 0 - 53
src/flow/flowkey.h

@@ -1,53 +0,0 @@
-/* $Id: flowkey.h 1529 2006-07-26 18:18:13Z aturner $ */
-
-/*
- * Copyright (c) 2001-2004 Aaron Turner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright owners nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#ifndef __FLOWKEY_H__
-#define __FLOWKEY_H__
-
-#include "flowreplay.h"
-#include "tcpreplay.h"
-
-int rbkeygen(ipv4_hdr_t *, u_char, void *, u_char *);
-u_int64_t pkeygen(u_char[]);
-
-#endif
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-
-

+ 0 - 291
src/flow/flownode.c

@@ -1,291 +0,0 @@
-/* $Id: flownode.c 1542 2006-07-29 06:19:22Z aturner $ */
-
-/*
- * Copyright (c) 2001-2004 Aaron Turner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright owners nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "defines.h"
-#include "common.h"
-
-#include "flowreplay.h"
-#include "flownode.h"
-#include "flowkey.h"
-#include "flowstate.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-extern struct session_tree tcproot, udproot;
-extern int nfds;
-extern flowreplay_opt_t options;
-
-/* prepare the RB trees for tcp and udp sessions */
-RB_PROTOTYPE(session_tree, session_t, node, rbsession_comp)
-RB_GENERATE(session_tree, session_t, node, rbsession_comp)
-
-
-/*
- * returns the session_t structure
- * based upon the key given for the RB root (one root per
- * protocol).  If the key doesn't exist, it will return NULL
- *
- * NOTE: This function is broken!  key's are not guaranteed
- * to be unique for all combinations of sessions.  What we
- * really should be doing is using a rbtree using a 32bit
- * key and then solving for collisions via a linked list.
- * this would probably be faster for the common case and still
- * provide adequate speed for collisions rather then ignoring
- * the collsion problem all together.
- */
-struct session_t *
-getnodebykey(char proto, u_char * key)
-{
-    struct session_t *node = NULL;
-    struct session_t like;
-
-    like.socket = -1;
-    memcpy(like.key, key, RBKEYLEN);
-
-    if (proto == IPPROTO_TCP) {
-        if ((node = RB_FIND(session_tree, &tcproot, &like)) == NULL) {
-            dbgx(3, "Couldn't find TCP key: 0x%llx", pkeygen(key));
-            return (NULL);
-        }
-    }
-
-    else if (proto == IPPROTO_UDP) {
-        if ((node = RB_FIND(session_tree, &udproot, &like)) == NULL) {
-            dbgx(3, "Couldn't find UDP key: 0x%llx", pkeygen(key));
-            return (NULL);
-        }
-    }
-
-    else {
-        warnx("Invalid tree protocol: 0x%x", proto);
-        return (NULL);
-    }
-
-    dbgx(3, "Found 0x%llx in the tree", pkeygen(key));
-    return (node);
-
-}
-
-/*
- * inserts a node into a tree.
- * we fill out the node and create a new open socket 
- * we then return the node or NULL on error
- */
-struct session_t *
-newnode(_U_ char proto, u_char * key, ipv4_hdr_t * ip_hdr, void *l4)
-{
-    struct sockaddr_in sa;
-    struct session_t *newnode = NULL;
-    const int on = 1;
-    tcp_hdr_t *tcp_hdr = NULL;
-    udp_hdr_t *udp_hdr = NULL;
-
-
-    dbgx(2, "Adding new node: 0x%llx", pkeygen(key));
-
-    newnode = (struct session_t *)safe_malloc(sizeof(struct session_t));
-
-    memcpy(newnode->key, key, RBKEYLEN);
-
-    newnode->proto = ip_hdr->ip_p;
-
-    /* create a TCP or UDP socket & insert it in the tree */
-    if (newnode->proto == IPPROTO_TCP) {
-        /* is this a Syn packet? */
-        tcp_hdr = (tcp_hdr_t *) l4;
-
-        /* No new flows for non-Syn packets, unless NoSyn is set */
-        if ((tcp_hdr->th_flags != TH_SYN) && (options.nosyn == 0)) {
-            safe_free(newnode);
-            warnx("We won't connect (%s:%d -> %s:%d) on non-Syn packets",
-                  get_addr2name4(ip_hdr->ip_src.s_addr, DNS_DONT_RESOLVE),
-                  ntohs(tcp_hdr->th_sport),
-                  get_addr2name4(ip_hdr->ip_dst.s_addr, DNS_DONT_RESOLVE),
-                  ntohs(tcp_hdr->th_dport));
-            return (NULL);
-        }
-
-        /* otherwise, continue on our merry way */
-        newnode->server_ip = ip_hdr->ip_dst.s_addr;
-        newnode->server_port = tcp_hdr->th_dport;
-
-        /* figure out what we should set the state to */
-        tcp_state(tcp_hdr, newnode);
-
-        newnode->direction = C2S;
-        newnode->wait = DONT_WAIT;
-
-        if ((newnode->socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
-            safe_free(newnode);
-            warnx("Unable to create new TCP socket: %s", strerror(errno));
-            return (NULL);
-        }
-
-        /* make our socket reusable */
-        setsockopt(newnode->socket, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
-
-        RB_INSERT(session_tree, &tcproot, newnode);
-        sa.sin_port = tcp_hdr->th_dport;
-    }
-
-    else if (newnode->proto == IPPROTO_UDP) {
-        udp_hdr = (udp_hdr_t *) l4;
-        /* 
-         * we're not as smart about UDP as TCP so we just assume
-         * the first UDP packet is client->server unless we're 
-         * told otherwise
-         */
-
-        if ((options.clients != NULL)
-            && (check_ip_cidr(options.clients, ip_hdr->ip_src.s_addr))) {
-            /* source IP is client */
-            dbgx(3, "UDP match client CIDR.  Server is destination IP: %s",
-                get_addr2name4(ip_hdr->ip_dst.s_addr, DNS_DONT_RESOLVE));
-            newnode->server_ip = ip_hdr->ip_dst.s_addr;
-        }
-        else if ((options.servers != NULL)
-                 && (check_ip_cidr(options.servers, ip_hdr->ip_src.s_addr))) {
-            /* source IP is server */
-            dbgx(3, "UDP match server CIDR.  Server is source IP: %s",
-                get_addr2name4(ip_hdr->ip_src.s_addr, DNS_DONT_RESOLVE));
-            newnode->server_ip = ip_hdr->ip_src.s_addr;
-        }
-        else {
-            /* first packet is client */
-            dbgx(3, "UDP client is first sender.  Server is: %s",
-                get_addr2name4(ip_hdr->ip_src.s_addr, DNS_DONT_RESOLVE));
-            newnode->server_ip = ip_hdr->ip_dst.s_addr;
-        }
-        newnode->server_port = udp_hdr->uh_dport;
-        newnode->direction = C2S;
-        newnode->wait = DONT_WAIT;
-
-        if ((newnode->socket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
-            safe_free(newnode);
-            warnx("Unable to create new UDP socket: %s", strerror(errno));
-            return (NULL);
-        }
-
-        /* make our socket reusable */
-        setsockopt(newnode->socket, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
-
-        RB_INSERT(session_tree, &udproot, newnode);
-        sa.sin_port = udp_hdr->uh_dport;
-    }
-
-    /* connect to socket */
-    sa.sin_family = AF_INET;
-
-    /* set the appropriate destination IP */
-    if (options.targetaddr.s_addr != 0) {
-        sa.sin_addr = options.targetaddr;
-    }
-    else {
-        sa.sin_addr = ip_hdr->ip_dst;
-    }
-
-    if (connect
-        (newnode->socket, (struct sockaddr *)&sa,
-         sizeof(struct sockaddr_in)) < 0) {
-        safe_free(newnode);
-        warnx("Unable to connect to %s:%hu: %s", get_addr2name4(sa.sin_addr.s_addr, RESOLVE),
-              ntohs(sa.sin_port), strerror(errno));
-        return (NULL);
-    }
-
-    dbgx(2, "Connected to %s:%hu as socketID: %d", get_addr2name4(sa.sin_addr.s_addr, RESOLVE),
-        ntohs(sa.sin_port), newnode->socket);
-
-    /* increment nfds so our select() works */
-    if (nfds <= newnode->socket)
-        nfds = newnode->socket + 1;
-
-    return (newnode);
-}
-
-/*
- * compare two session_t structs for the RB_TREE compare
- */
-int
-rbsession_comp(struct session_t *a, struct session_t *b)
-{
-    return (memcmp(a->key, b->key, RBKEYLEN));
-
-}
-
-/*
- * A wrapper around RB_REMOVE to delete a node from a tree
- */
-
-void
-delete_node(struct session_tree *root, struct session_t *node)
-{
-    dbgx(2, "Deleting node 0x%llx", pkeygen(node->key));
-    RB_REMOVE(session_tree, root, node);
-}
-
-
-void
-close_sockets(void)
-{
-    int tcpcount = 0, udpcount = 0;
-    struct session_t *node = NULL;
-
-    /* close the TCP sockets */
-    RB_FOREACH(node, session_tree, &tcproot) {
-        close(node->socket);
-        tcpcount++;
-    }
-
-    /* close the UDP sockets */
-    RB_FOREACH(node, session_tree, &udproot) {
-        close(node->socket);
-        udpcount++;
-    }
-    dbgx(1, "Closed %d tcp and %d udp socket(s)", tcpcount, udpcount);
-}
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-

+ 0 - 103
src/flow/flownode.h

@@ -1,103 +0,0 @@
-/* $Id: flownode.h 1529 2006-07-26 18:18:13Z aturner $ */
-
-/*
- * Copyright (c) 2001-2004 Aaron Turner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright owners nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __FLOWNODE_H__
-#define __FLOWNODE_H__
-
-#include <sys/types.h>
-#include "tcpreplay.h"
-#include "flowkey.h"
-#include "lib/tree.h"
-
-#define RBKEYLEN 12
-
-/* linked list data structure of buffered packets */
-struct pktbuffhdr_t {
-    u_int32_t len;              /* packet length */
-    u_char *packet;             /* packet data */
-    struct pktbuffhdr_t *next;  /* next packet */
-};
-
-/* Links a session in the pcap with the fd of the socket */
-struct session_t {
-    RB_ENTRY(session_t) node;
-    u_char key[RBKEYLEN];       /* lookup id for this node 
-                                 * which is the high IP + low IP + high port + low port
-                                 */
-    int socket;                 /* socket fd */
-    u_int32_t server_ip;        /* ip we're connecting to */
-    u_int32_t count;            /* number of packets so far in the flow */
-    u_int32_t data_expected;    /* # of bytes expected from server until we send again */
-    u_int32_t data_recieved;    /* # of bytes recieved from server */
-    u_int16_t server_port;      /* port we're connecting to */
-    u_char state;               /* TCP state */
-    u_char proto;               /* IPPROTO_TCP, UDP */
-    u_char direction;           /* direction of the flow */
-#define C2S 0x1
-#define S2C 0x2
-    u_char wait;                /* are we waiting for the server to reply? */
-#define WAIT 0x1
-#define DONT_WAIT 0x2
-    struct pktbuffhdr_t *buffered;  /* linked list of packets buffered */
-    struct pktbuffhdr_t *lastbuff;  /* pointer to last packet buffered */
-    struct pktbuffhdr_t *sentbuff;  /* pointer to last packet sent */
-    u_int32_t buffmem;          /* bytes currently in use by the packet buff linked list */
-};
-
-
-/* 
- * custom replacement for RB_HEAD() so we can use the
- * same struct for the tree type, with different 
- * tree heads
- */
-struct session_tree {
-    struct session_t *rbh_root;
-};
-
-
-struct session_t *getnodebykey(char, u_char *);
-struct session_t *newnode(char, u_char *, ipv4_hdr_t *, void *);
-int rbsession_comp(struct session_t *, struct session_t *);
-void delete_node(struct session_tree *, struct session_t *);
-void close_sockets(void);
-
-#endif
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-
-

+ 0 - 141
src/flow/flowstate.c

@@ -1,141 +0,0 @@
-/* $Id: flowstate.c 1477 2006-07-08 03:54:51Z aturner $ */
-
-/*
- * Copyright (c) 2001-2004 Aaron Turner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright owners nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "defines.h"
-#include "common.h"
-
-#include "flowreplay.h"
-#include "flownode.h"
-#include "flowstate.h"
-
-/*
- * determines the new state for a TCP flow based on 
- * the last known state and the current packet
- * returns the new state as well as setting it in the node
- */
-u_int32_t
-tcp_state(tcp_hdr_t * tcp_hdr, struct session_t *node)
-{
-    /* 
-     * figure out the TCP state 
-     */
-    if (node->state == 0x0) {
-        /*
-         * We go here if this is the first packet in the 
-         * in the TCP stream.  This could be a Syn or
-         * if we're trying to pickup the state from mid-stream
-         */
-
-        /* = Syn, start of new flow */
-        if (tcp_hdr->th_flags & TH_SYN) {
-            node->state = TH_SYN;
-            dbg(3, "Setting state: New -> Syn");
-        }
-
-        /* Anything matching after this point is a mid-stream pickup */
-
-        /* + Ack */
-        if (tcp_hdr->th_flags & TH_ACK) {
-            node->state ^= TH_ACK;
-            dbg(3, "Mid-stream state pickup: +Ack");
-        }
-
-        /* = Fin */
-        if (tcp_hdr->th_flags & TH_FIN) {
-            node->state = TH_FIN;
-            dbg(3, "Mid-stream state pickup: Fin");
-        }
-
-        /* else, just close */
-        if (!node->state) {
-            node->state = TCP_CLOSE;
-            dbg(3, "Mid-stream state pickup: Close");
-        }
-
-    }
-
-    /* look for a Syn/Ack while we're in Syn */
-    else if ((tcp_hdr->th_flags & TH_SYN) &&
-             (tcp_hdr->th_flags & TH_ACK) && (node->state == TH_SYN)) {
-        /* server sent SYN/ACK */
-        node->state = TH_SYN | TH_ACK;
-        dbg(4, "Setting state: Syn -> Syn/Ack");
-    }
-
-    else if ((tcp_hdr->th_flags & TH_ACK) &&
-             (node->state & TH_SYN) && (node->state & TH_ACK)) {
-        /* Client sent ACK when we're Syn/Ack */
-        node->state = TH_ACK;
-        dbg(4, "Setting state: Syn/Ack -> Ack");
-    }
-
-    /* someone sent us the FIN */
-    else if (tcp_hdr->th_flags & TH_FIN) {
-        if (node->state == TH_ACK) {
-            /* first FIN */
-            node->state = TH_FIN;
-            dbg(4, "Setting state: Ack -> Fin");
-        }
-        else {
-            /* second FIN, close connection */
-            dbg(4, "Setting state: Fin -> Close");
-            node->state = TCP_CLOSE;
-        }
-    }
-
-    /* Reset */
-    else if (tcp_hdr->th_flags & TH_RST) {
-        dbg(4, "Reset packet!  Setting state: Rst");
-        node->state = TCP_CLOSE;
-    }
-
-    else if ((node->state == TH_ACK) && (tcp_hdr->th_flags & TH_ACK)) {
-        dbg(3, "No state change: Ack");
-    }
-
-    else {
-        warnx("Unable to determine TCP state for node 0x%llx",
-              pkeygen(node->key));
-    }
-    return node->state;
-}
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-
-

+ 0 - 52
src/flow/flowstate.h

@@ -1,52 +0,0 @@
-/* $Id: flowstate.h 1477 2006-07-08 03:54:51Z aturner $ */
-
-/*
- * Copyright (c) 2001-2004 Aaron Turner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright owners nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __FLOWSTATE_H__
-#define __FLOWSTATE_H__
-
-#include "flownode.h"
-
-#define TCP_CLOSE 0x40          /* 7th bit set */
-
-u_int32_t tcp_state(tcp_hdr_t * tcp_hdr, struct session_t *node);
-
-#endif
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-
-

+ 0 - 172
src/flowreplay.1

@@ -1,172 +0,0 @@
-.TH FLOWREPLAY 1 2007-08-26 "(flowreplay )" "Programmer's Manual"
-.\"  DO NOT EDIT THIS FILE   (flowreplay.1)
-.\"  
-.\"  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:05 PM PDT
-.\"  From the definitions    flowreplay_opts.def
-.\"  and the template file   agman1.tpl
-.\"
-.SH NAME
-flowreplay \- Connect to servers based on network traffic stored in pcap files
-.SH SYNOPSIS
-.B flowreplay
-.\" Mixture of short (flag) options and long options
-.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \--\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
-.br
-.in +8
-<pcap_file(s)>
-.PP
-flowreplay is a tool for using network traffic stored in pcap(3) files as
-the basis for replaying connections to servers.
-.SH "DESCRIPTION"
-This manual page documents, briefly, the \fBflowreplay\fP command.
-Please note that flowreplay is currently in \fBalpha\fP.  As such, it is still
-very much a work in progress and currently will not work for most uses.  If
-you have the skill and interest to help make flowreplay work better, please
-contact Aaron Turner.
-
-For more details, please see the Tcpreplay Manual at:
-http://tcpreplay.synfin.net/trac/wiki/manual
-.SH OPTIONS
-.TP
-.BR \-d " \fInumber\fP, " \--dbug "=" \fInumber\fP
-Enable debugging output.
-This option may appear up to 1 times.
-This option takes an integer number as its argument.
-The value of \fInumber\fP is constrained to being:
-.in +4
-.nf
-.na
-in the range  0 through 5
-.fi
-.in -4
-The default \fInumber\fP for this option is:
-.ti +4
- 0
-.sp
-If configured with \--enable-debug, then you can specify a verbosity 
-level for debugging output.  Higher numbers increase verbosity.
-.TP
-.BR \-v ", " \--verbose
-Print decoded packets via tcpdump to STDOUT.
-This option may appear up to 1 times.
-.sp
-
-.TP
-.BR \-A " \fIstring\fP, " \--decode "=" \fIstring\fP
-Arguments passed to tcpdump decoder.
-This option may appear up to 1 times.
-This option must appear in combination with the following options:
-verbose.
-.sp
-When enabling verbose mode (\fB-v\fP) you may also specify one or more
-additional  arguments to pass to \fBtcpdump\fP to modify the way packets
-are decoded.  By default, \-n and \-l are used.   Be  sure  to
-quote the arguments like: \-A "-axxx" so that they are not interpreted
-by tcpreplay.  The following arguments are vaild:
-    [ \-aAeNqRStuvxX ]
-    [ \-E spi@ipaddr algo:secret,... ]
-    [ \-s snaplen ]
-.TP
-.BR \-m " \fIstring\fP, " \--mode "=" \fIstring\fP
-Replay mode.
-This option may appear up to 1 times.
-.sp
-Flowreplay needs to know handle client/server exchanges to properly time.
-The options are:
-.sp
-.IR "\fBsend\fP"
-Replay traffic as fast as possible.  Do not wait for server to reply.
-.sp
-.IR "\fBwait\fP"
-Wait \fB--wait\fP sec.usec for the server to reply before sending.
-.sp
-.IR "\fBbytes\fP"
-Wait until the server has sent the number of bytes stored in the pcap file.
-.sp
-.IR "\fBuser\fP"
-Send packets based on user interaction.
-.br
-.TP
-.BR \-w " \fIstring\fP, " \--wait "=" \fIstring\fP
-Number of sec.usec to wait between client's turn to send.
-This option may appear up to 1 times.
-.sp
-If \fB--mode\fP is \fBwait\fP, then you can specify the amount of time to 
-wait for the server to complete it's side of the transaction before starting
-to send the client side again.
-.TP
-.BR \-t " \fIstring\fP, " \--targetip "=" \fIstring\fP
-Target host to connect to.
-This option may appear up to 1 times.
-.sp
-This option has not been fully documented.
-.TP
-.BR \-f " \fIstring\fP, " \--filter "=" \fIstring\fP
-BPF filter to limit which flows are replayed.
-This option may appear up to 1 times.
-.sp
-
-.TP
-.BR \-c " \fIstring\fP, " \--clientnet "=" \fIstring\fP
-Client network(s).
-.sp
-This option has not been fully documented.
-.TP
-.BR \-s " \fIstring\fP, " \--servernet "=" \fIstring\fP
-Server network(s).
-.sp
-This option has not been fully documented.
-.TP
-.BR \-n ", " \--nosyn
-Disable Syn packet requirement to start connections.
-.sp
-This option has not been fully documented.
-.TP
-.BR \-l " \fIstring\fP, " \--slimit "=" \fIstring\fP
-Service limit to proto/port.
-.sp
-This option has not been fully documented.
-.TP
-.BR \-V ", " \--version
-Print version information.
-.sp
-
-.TP
-.BR \-h ", " \--less-help
-Display less usage information and exit.
-.sp
-
-.TP
-.BR \-H , " \--help"
-Display usage information and exit.
-.TP
-.BR \-! , " \--more-help"
-Extended usage information passed thru pager.
-.TP
-.BR \- " [\fIrcfile\fP]," " \--save-opts" "[=\fIrcfile\fP]"
-Save the option state to \fIrcfile\fP.  The default is the \fIlast\fP
-configuration file listed in the \fBOPTION PRESETS\fP section, below.
-.TP
-.BR \- " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
-Load options from \fIrcfile\fP.
-The \fIno-load-opts\fP form will disable the loading
-of earlier RC/INI files.  \fI--no-load-opts\fP is handled early,
-out of order.
-.SH OPTION PRESETS
-Any option that is not marked as \fInot presettable\fP may be preset
-by loading values from configuration ("RC" or ".INI") file(s).
-The \fIhomerc\fP file is "\fI$$/\fP", unless that is a directory.
-In that case, the file "\fI.flowreplayrc\fP"
-is searched for within that directory.
-.SH AUTHOR
-Copyright 2000-2007 Aaron Turner
-
-For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
-
-The latest version of this software is always available from:
-http://tcpreplay.synfin.net/
-.PP
-Released under the Free BSD License.
-.PP
-This manual page was \fIAutoGen\fP-erated from the \fBflowreplay\fP
-option definitions.

+ 0 - 471
src/flowreplay.c

@@ -1,471 +0,0 @@
-/* $Id: flowreplay.c 1757 2007-03-22 05:38:56Z aturner $ */
-
-/*
- * Copyright (c) 2001-2004 Aaron Turner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright owners nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "defines.h"
-#include "common.h"
-
-#include <unistd.h>             /* getopt() */
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>          /* socket */
-#include <sys/socket.h>
-#include <sys/select.h>         /* select() */
-#include <netinet/in.h>         /* inet_aton() */
-#include <arpa/inet.h>
-#include <string.h>             /* strtok() */
-#include <strings.h>            /* strcasecmp() */
-//#include <nids.h>               /* libnids */
-
-#include "flowreplay.h"
-#include "flowreplay_opts.h"
-#include "flow/flownode.h"
-#include "flow/flowkey.h"
-#include "flow/flowstate.h"
-#include "flow/flowbuff.h"
-#include "tree.h"
-
-#ifdef DEBUG
-int debug = 0;
-#endif
-
-/* libnids external vars 
-extern struct nids_prm nids_params;
-extern char nids_errbuf[];
-*/
-
-static void cleanup(void);
-static void init(void);
-static void post_args(int argc, char *argv[]);
-int main_loop(pcap_t *);
-int process_packet(struct session_t *, ip_hdr_t *, void *);
-
-/*
- * Global options
- */
-
-flowreplay_opt_t options;
-
-struct session_tree tcproot, udproot;
-
-/* file descriptor stuff */
-fd_set fds;
-int nfds = 0;
-
-int
-main(int argc, char *argv[])
-{
-    int optct, i;
-    char ebuf[PCAP_ERRBUF_SIZE];
-    pcap_t *pcap = NULL;
-    int first_run = 0;
-
-    init();
-
-    /* call autoopts to process args */
-    optct = optionProcess(&flowreplayOptions, argc, argv);
-    argc -= optct;
-    argv += optct;
-
-    post_args(argc, argv);
-
-
-    /* loop through the input file(s) */
-    for (i = 0; i < argc; i++) {
-
-        /* set the libnids filename to our file 
-        nids_params.filename = argv[i];
-        */
-
-        /* init libnids 
-        if (!nids_init())
-            errx(1, "libnids error: %s", nids_errbuf);
-        */
-
-        if (! first_run) {
-            first_run = 1;
-            /*
-            nids_register_tcp(tcp_callback);
-            nids_register_udp(udp_callback);
-            */
-        }
-
-        
-        /* play the pcap 
-        nids_dispatch(-1);
-        */
-
-        /* Close the pcap file */
-//        pcap_close(nids_params.desc);
-
-    }
-
-    /* close our tcp sockets, etc */
-    cleanup();
-
-    return (0);
-}
-
-
-/*
- * main_loop()
- */
-
-int
-main_loop(pcap_t * pcap)
-{
-    eth_hdr_t *eth_hdr = NULL;
-    ip_hdr_t *ip_hdr = NULL;
-    tcp_hdr_t *tcp_hdr = NULL;
-    udp_hdr_t *udp_hdr = NULL;
-    u_char pktdata[MAXPACKET];
-    u_int32_t count = 0;
-    u_int32_t send_count = 0;
-    u_char key[12] = "";
-    struct pcap_pkthdr header;
-    const u_char *packet = NULL;
-    struct session_t *node = NULL;
-
-    /* process each packet */
-    while ((packet = pcap_next(pcap, &header)) != NULL) {
-        count++;
-
-        /* we only process IP packets */
-        eth_hdr = (eth_hdr_t *) packet;
-        if (ntohs(eth_hdr->ether_type) != ETHERTYPE_IP) {
-            dbgx(2, "************ Skipping non-IP packet #%u ************",
-                count);
-            continue;           /* next packet */
-        }
-
-        /* zero out old packet info */
-        memset(&pktdata, '\0', sizeof(pktdata));
-
-        /* 
-         * copy over everything except the eth hdr. This byte-aligns 
-         * everything up nicely for us
-         */
-        memcpy(&pktdata, (packet + sizeof(eth_hdr_t)),
-               (header.caplen - sizeof(eth_hdr_t)));
-
-        ip_hdr = (ip_hdr_t *) & pktdata;
-
-        /* TCP */
-        if ((options.proto == 0x0 || options.proto == IPPROTO_TCP)
-            && (ip_hdr->ip_p == IPPROTO_TCP)) {
-            tcp_hdr = (tcp_hdr_t *) get_layer4(ip_hdr);
-
-            /* skip if port is set and not our port */
-            if ((options.port) && (tcp_hdr->th_sport != options.port &&
-                           tcp_hdr->th_dport != options.port)) {
-                dbgx(3, "Skipping packet #%u based on port not matching", count);
-                continue;       /* next packet */
-            }
-