Browse Source

Import upstream version 3.2.1

Aaron Turner 16 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 */
-            }
-
-            dbgx(2, "************ Processing packet #%u ************", count);
-            if (!rbkeygen(ip_hdr, IPPROTO_TCP, (void *)tcp_hdr, key))
-                continue;       /* next packet */
-
-            /* find an existing sockfd or create a new one! */
-            if ((node = getnodebykey(IPPROTO_TCP, key)) == NULL) {
-                if ((node = newnode(IPPROTO_TCP, key, ip_hdr, tcp_hdr)) == NULL) {
-                    /* skip if newnode() doesn't create a new node for us */
-                    continue;   /* next packet */
-                }
-            }
-            else {
-                /* calculate the new TCP state */
-                if (tcp_state(tcp_hdr, node) == TCP_CLOSE) {
-                    dbgx(2, "Closing socket #%u on second Fin", node->socket);
-                    close(node->socket);
-
-                    /* destroy our node */
-                    delete_node(&tcproot, node);
-                    continue;   /* next packet */
-                }
-
-                /* send the packet? */
-                if (process_packet(node, ip_hdr, tcp_hdr))
-                    send_count++;   /* number of packets we've actually sent */
-            }
-        }
-        /* UDP */
-        else if ((options.proto == 0x0 || options.proto == IPPROTO_UDP)
-                 && (ip_hdr->ip_p == IPPROTO_UDP)) {
-            udp_hdr = (udp_hdr_t *) get_layer4(ip_hdr);
-
-            /* skip if port is set and not our port */
-            if ((options.port) && (udp_hdr->uh_sport != options.port &&
-                           udp_hdr->uh_dport != options.port)) {
-                dbgx(2, "Skipping packet #%u based on port not matching", count);
-                continue;       /* next packet */
-            }
-
-            dbgx(2, "************ Processing packet #%u ************", count);
-
-            if (!rbkeygen(ip_hdr, IPPROTO_UDP, (void *)udp_hdr, key))
-                continue;       /* next packet */
-
-            /* find an existing socket or create a new one! */
-            if ((node = getnodebykey(IPPROTO_UDP, key)) == NULL) {
-                if ((node = newnode(IPPROTO_UDP, key, ip_hdr, udp_hdr)) == NULL) {
-                    /* skip if newnode() doesn't create a new node for us */
-                    continue;   /* next packet */
-                }
-            }
-
-            if (process_packet(node, ip_hdr, udp_hdr))
-                send_count++;   /* number of packets we've actually sent */
-
-        }
-        /* non-TCP/UDP */
-        else {
-            dbgx(2, "Skipping non-TCP/UDP packet #%u (0x%x)", count,
-                ip_hdr->ip_p);
-        }
-
-        /* add a packet to our counter */
-        node->count++;
-
-    }
-
-    /* print number of packets we actually sent */
-    dbgx(1, "Sent %d packets containing data", send_count);
-    return (count);
-}
-
-/*
- * actually decides wether or not to send the packet and does the work
- */
-int
-process_packet(struct session_t *node, ip_hdr_t * ip_hdr, void *l4)
-{
-    tcp_hdr_t *tcp_hdr = NULL;
-    udp_hdr_t *udp_hdr = NULL;
-    u_char data[MAXPACKET];
-    int len = 0;
-    struct sockaddr_in sa;
-
-    memset(data, '\0', MAXPACKET);
-
-    if (node->proto == IPPROTO_TCP) {
-        /* packet is TCP */
-        tcp_hdr = (tcp_hdr_t *) l4;
-        len =
-            ntohs(ip_hdr->ip_len) - (ip_hdr->ip_hl * 4) - (tcp_hdr->th_off * 4);
-
-        /* check client to server */
-        if ((ip_hdr->ip_dst.s_addr == node->server_ip) &&
-            (tcp_hdr->th_dport == node->server_port)) {
-
-            dbg(4, "Packet is client -> server");
-            /* properly deal with TCP options */
-            memcpy(data, (void *)((u_int32_t *) tcp_hdr + tcp_hdr->th_off),
-                   len);
-
-            /* reset direction if client has something to send */
-            if (len) {
-                node->direction = C2S;
-            }
-        }
-
-        /* check server to client */
-        else if ((ip_hdr->ip_src.s_addr == node->server_ip) &&
-                 (tcp_hdr->th_sport == node->server_port)) {
-
-            dbg(4, "Packet is server -> client");
-
-            /* reset direction and add server_data len */
-            if (node->direction == C2S) {
-                node->direction = S2C;
-                node->data_expected = len;
-            }
-            else {
-                node->data_expected += len;
-            }
-
-            dbgx(4, "Server data = %lu", node->data_expected);
-            return (0);
-        }
-
-    }
-    else if (node->proto == IPPROTO_UDP) {
-        /* packet is UDP */
-        udp_hdr = (udp_hdr_t *) l4;
-        len = ntohs(ip_hdr->ip_len) - (ip_hdr->ip_hl * 4) - sizeof(udp_hdr_t);
-
-        /* check client to server */
-        if ((ip_hdr->ip_dst.s_addr == node->server_ip) &&
-            (udp_hdr->uh_dport == node->server_port)) {
-
-            dbg(4, "Packet is client -> server");
-            memcpy(data, (udp_hdr + 1), len);
-
-            /* reset direction if client has something to send */
-            if (len) {
-                node->direction = C2S;
-            }
-        }
-
-        /* check server to client */
-        else if ((ip_hdr->ip_src.s_addr == node->server_ip) &&
-                 (udp_hdr->uh_sport == node->server_port)) {
-
-            dbg(4, "Packet is server -> client");
-            if (node->direction == C2S) {
-                node->direction = S2C;
-                node->data_expected = len;
-            }
-            else {
-                node->data_expected += len;
-            }
-
-            dbgx(4, "Server data = %lu", node->data_expected);
-            return (0);
-        }
-    }
-    else {
-        warnx("process_packet() doesn't know how to deal with proto: 0x%x",
-              node->proto);
-        return (0);
-    }
-
-    if (!len) {
-        dbg(4, "Skipping packet. len = 0");
-        return (0);
-    }
-
-    dbgx(4, "Sending %d bytes of data", len);
-    if (node->proto == IPPROTO_TCP) {
-        if (send(node->socket, data, len, 0) != len) {
-            warnx("Error sending data on socket %d (0x%llx)\n%s", node->socket,
-                  pkeygen(node->key), strerror(errno));
-        }
-    }
-    else {
-        sa.sin_family = AF_INET;
-        sa.sin_port = node->server_port;
-        sa.sin_addr.s_addr = node->server_ip;
-        if (sendto
-            (node->socket, data, len, 0, (struct sockaddr *)&sa,
-             sizeof(sa)) != len) {
-            warnx("Error sending data on socket %d (0x%llx)\n%s", node->socket,
-                  pkeygen(node->key), strerror(errno));
-        }
-    }
-    return (len);
-}
-
-
-static void
-init(void)
-{
-
-    /* init stuff */
-    FD_ZERO(&fds);
-    RB_INIT(&tcproot);
-    RB_INIT(&udproot);
-
-    memset(&options.targetaddr, '\0', sizeof(struct in_addr));
-    memset(&options, '\0', sizeof(flowreplay_opt_t));
-
-    options.sendmode = MODE_SEND;
-    options.pernodebufflim = PER_NODE_BUFF_LIMIT;
-    options.totalbufflim = TOTAL_BUFF_LIMIT;
-    
-}
-
-
-
-static void
-post_args(int argc, char *argv[])
-{
-    int i;
-    char filter[PCAP_FILTER_LEN];
-
-    /*
-     * Verify input 
-     */
-
-#ifdef DEBUG
-    if (HAVE_OPT(DBUG))
-        debug = OPT_VALUE_DBUG;
-#else
-    if (HAVE_OPT(DBUG))
-        warn("not configured with --enable-debug.  Debugging disabled.");
-#endif
-    
-    /* if -m wait, then must use -w */
-    if ((options.sendmode == MODE_WAIT) && (!timerisset(&options.timeout)))
-        err(1, "You must specify a wait period with -m wait");
-
-    /* Can't specify client & server CIDR */
-    if ((options.clients != NULL) && (options.servers != NULL))
-        err(1, "You can't specify both a client and server cidr block");
-
-    /* check for valid stdin */
-    if (argc > 1)
-        for (i = 0; i < argc; i++)
-            if (!strcmp("-", argv[i]))
-                err(1, "stdin must be the only file specified");
-
-    /* apply our pcap filter, with the necessary stuff to handle IP frags */
-    if (HAVE_OPT(FILTER)) {
-        strlcpy(filter, OPT_ARG(FILTER), PCAP_FILTER_LEN);
-        strlcat(filter, " or (ip[6:2] & 0x1fff != 0)", PCAP_FILTER_LEN);
-//        nids_params.pcap_filter = safe_strdup(filter);
-    }
-
-}
-
-/*
- * cleanup after ourselves
- */
-
-static void
-cleanup(void)
-{
-
-    dbg(1, "cleanup()");
-
-    close_sockets();
-
-}
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-

+ 0 - 75
src/flowreplay.h

@@ -1,75 +0,0 @@
-/* $Id: flowreplay.h 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.
- */
-
-#ifndef _FLOWREPLAY_H_
-#define _FLOWREPLAY_H_
-
-#include "config.h"
-#include "defines.h"
-
-#include <sys/types.h>
-
-#define MODE_SEND  0x1
-#define MODE_WAIT  0x2
-#define MODE_BYTES 0x3
-#define MODE_USER  0x4
-
-#define PCAP_FILTER_LEN 1024
-
-/* runtime options */
-struct flowreplay_opt_s {
-    int sendmode;
-    int nosyn;          /* require Syn to start flow? */
-    struct in_addr targetaddr; /* target host */
-    tcpr_cidr_t *clients;
-    tcpr_cidr_t *servers;
-    struct timeval timeout;
-    u_int32_t pernodebufflim;
-    u_int32_t totalbufflim;
-    u_int16_t port;
-    u_char proto;
-    u_char spacer; /* make 4 byte aligned */
-};
-
-typedef struct flowreplay_opt_s flowreplay_opt_t;
-
-#endif
-
-/*
- Local Variables:
- mode:c
- indent-tabs-mode:nil
- c-basic-offset:4
- End:
-*/
-
-

+ 0 - 934
src/flowreplay_opts.c

@@ -1,934 +0,0 @@
-/*   -*- buffer-read-only: t -*- vi: set ro:
- *  
- *  DO NOT EDIT THIS FILE   (flowreplay_opts.c)
- *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:04 PM PDT
- *  From the definitions    flowreplay_opts.def
- *  and the template file   options
- *
- * Generated from AutoOpts 30:0:5 templates.
- */
-
-/*
- *  This file was produced by an AutoOpts template.  AutoOpts is a
- *  copyrighted work.  This source file is not encumbered by AutoOpts
- *  licensing, but is provided under the licensing terms chosen by the
- *  flowreplay author or copyright holder.  AutoOpts is licensed under
- *  the terms of the LGPL.  The redistributable library (``libopts'') is
- *  licensed under the terms of either the LGPL or, at the users discretion,
- *  the BSD license.  See the AutoOpts and/or libopts sources for details.
- *
- * This source file is copyrighted and licensed under the following terms:
- *
- * flowreplay copyright 2004-2007 Aaron Turner - all rights reserved
- *
- * flowreplay is free software copyrighted by Aaron Turner.
- * 
- * 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 name ``Aaron Turner'' nor the name of any other
- *    contributor may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- * 
- * flowreplay IS PROVIDED BY Aaron Turner ``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 Aaron Turner OR ANY OTHER CONTRIBUTORS
- * 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 <limits.h>
-#include <stdio.h>
-#define OPTION_CODE_COMPILE 1
-#include "flowreplay_opts.h"
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-tSCC zCopyright[] =
-       "flowreplay copyright (c) 2004-2007 Aaron Turner, all rights reserved";
-tSCC zCopyrightNotice[] =
-       "flowreplay is free software copyrighted by Aaron Turner.\n\n\
-Redistribution and use in source and binary forms, with or without\n\
-modification, are permitted provided that the following conditions\n\
-are met:\n\
-1. Redistributions of source code must retain the above copyright\n\
-   notice, this list of conditions and the following disclaimer.\n\
-2. Redistributions in binary form must reproduce the above copyright\n\
-   notice, this list of conditions and the following disclaimer in the\n\
-   documentation and/or other materials provided with the distribution.\n\
-3. Neither the name ``Aaron Turner'' nor the name of any other\n\
-   contributor may be used to endorse or promote products derived\n\
-   from this software without specific prior written permission.\n\n\
-flowreplay IS PROVIDED BY Aaron Turner ``AS IS'' AND ANY EXPRESS\n\
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n\
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n\
-ARE DISCLAIMED.  IN NO EVENT SHALL Aaron Turner OR ANY OTHER CONTRIBUTORS\n\
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n\
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n\
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n\
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n\
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n\
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n\
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
-extern tUsageProc optionUsage;
-
-/*
- *  global included definitions
- */
-#include "defines.h"
-#include "flowreplay.h"
-#include "common.h"
-#include "config.h"
-extern flowreplay_opt_t options;
-
-
-#ifndef NULL
-#  define NULL 0
-#endif
-#ifndef EXIT_SUCCESS
-#  define  EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-#  define  EXIT_FAILURE 1
-#endif
-/*
- *  Dbug option description:
- */
-#ifdef DEBUG
-tSCC    zDbugText[] =
-        "Enable debugging output";
-tSCC    zDbug_NAME[]               = "DBUG";
-tSCC    zDbug_Name[]               = "dbug";
-#define zDbugDefaultArg              ((char const*)0)
-#define DBUG_FLAGS       (OPTST_DISABLED | OPTST_IMM \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
-
-#else   /* disable Dbug */
-#define VALUE_OPT_DBUG NO_EQUIVALENT
-#define DBUG_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
-#define zDbugDefaultArg NULL
-#define zDbugText       NULL
-#define zDbug_NAME      NULL
-#define zDbug_Name      NULL
-#endif  /* DEBUG */
-
-/*
- *  Verbose option description:
- */
-#ifdef ENABLE_VERBOSE
-tSCC    zVerboseText[] =
-        "Print decoded packets via tcpdump to STDOUT";
-tSCC    zVerbose_NAME[]            = "VERBOSE";
-tSCC    zVerbose_Name[]            = "verbose";
-#define VERBOSE_FLAGS       (OPTST_DISABLED | OPTST_IMM)
-
-#else   /* disable Verbose */
-#define VALUE_OPT_VERBOSE NO_EQUIVALENT
-#define VERBOSE_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
-#define zVerboseText       NULL
-#define zVerbose_NAME      NULL
-#define zVerbose_Name      NULL
-#endif  /* ENABLE_VERBOSE */
-
-/*
- *  Decode option description with
- *  "Must also have options" and "Incompatible options":
- */
-#ifdef ENABLE_VERBOSE
-tSCC    zDecodeText[] =
-        "Arguments passed to tcpdump decoder";
-tSCC    zDecode_NAME[]             = "DECODE";
-tSCC    zDecode_Name[]             = "decode";
-static const int
-    aDecodeMustList[] = {
-    INDEX_OPT_VERBOSE, NO_EQUIVALENT };
-#define DECODE_FLAGS       (OPTST_DISABLED \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-#else   /* disable Decode */
-#define VALUE_OPT_DECODE NO_EQUIVALENT
-#define DECODE_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
-#define aDecodeMustList   NULL
-#define zDecodeText       NULL
-#define zDecode_NAME      NULL
-#define zDecode_Name      NULL
-#endif  /* ENABLE_VERBOSE */
-
-/*
- *  Mode option description:
- */
-tSCC    zModeText[] =
-        "Replay mode";
-tSCC    zMode_NAME[]               = "MODE";
-tSCC    zMode_Name[]               = "mode";
-#define MODE_FLAGS       (OPTST_DISABLED | OPTST_MUST_SET \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- *  Wait option description:
- */
-tSCC    zWaitText[] =
-        "Number of sec.usec to wait between client's turn to send";
-tSCC    zWait_NAME[]               = "WAIT";
-tSCC    zWait_Name[]               = "wait";
-#define WAIT_FLAGS       (OPTST_DISABLED \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- *  Targetip option description:
- */
-tSCC    zTargetipText[] =
-        "Target host to connect to";
-tSCC    zTargetip_NAME[]           = "TARGETIP";
-tSCC    zTargetip_Name[]           = "targetip";
-#define TARGETIP_FLAGS       (OPTST_DISABLED | OPTST_MUST_SET \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- *  Filter option description:
- */
-tSCC    zFilterText[] =
-        "BPF filter to limit which flows are replayed";
-tSCC    zFilter_NAME[]             = "FILTER";
-tSCC    zFilter_Name[]             = "filter";
-#define FILTER_FLAGS       (OPTST_DISABLED \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- *  Clientnet option description:
- */
-tSCC    zClientnetText[] =
-        "Client network(s)";
-tSCC    zClientnet_NAME[]          = "CLIENTNET";
-tSCC    zClientnet_Name[]          = "clientnet";
-#define CLIENTNET_FLAGS       (OPTST_DISABLED \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- *  Servernet option description:
- */
-tSCC    zServernetText[] =
-        "Server network(s)";
-tSCC    zServernet_NAME[]          = "SERVERNET";
-tSCC    zServernet_Name[]          = "servernet";
-#define SERVERNET_FLAGS       (OPTST_DISABLED \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- *  Nosyn option description:
- */
-tSCC    zNosynText[] =
-        "Disable Syn packet requirement to start connections";
-tSCC    zNosyn_NAME[]              = "NOSYN";
-tSCC    zNosyn_Name[]              = "nosyn";
-#define NOSYN_FLAGS       (OPTST_DISABLED)
-
-/*
- *  Slimit option description:
- */
-tSCC    zSlimitText[] =
-        "Service limit to proto/port";
-tSCC    zSlimit_NAME[]             = "SLIMIT";
-tSCC    zSlimit_Name[]             = "slimit";
-#define SLIMIT_FLAGS       (OPTST_DISABLED \
-        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- *  Version option description:
- */
-tSCC    zVersionText[] =
-        "Print version information";
-tSCC    zVersion_NAME[]            = "VERSION";
-tSCC    zVersion_Name[]            = "version";
-#define VERSION_FLAGS       (OPTST_DISABLED)
-
-/*
- *  Less_Help option description:
- */
-tSCC    zLess_HelpText[] =
-        "Display less usage information and exit";
-tSCC    zLess_Help_NAME[]          = "LESS_HELP";
-tSCC    zLess_Help_Name[]          = "less-help";
-#define LESS_HELP_FLAGS       (OPTST_DISABLED | OPTST_IMM)
-
-/*
- *  Help/More_Help option descriptions:
- */
-tSCC zHelpText[]       = "Display usage information and exit";
-tSCC zHelp_Name[]      = "help";
-
-tSCC zMore_HelpText[]  = "Extended usage information passed thru pager";
-tSCC zMore_Help_Name[] = "more-help";
-
-/*
- *  Save/Load_Opts option description:
- */
-tSCC zSave_OptsText[]     = "Save the option state to a config file";
-tSCC zSave_Opts_Name[]    = "save-opts";
-
-tSCC zLoad_OptsText[]     = "Load options from a config file";
-tSCC zLoad_Opts_NAME[]    = "LOAD_OPTS";
-
-tSCC zNotLoad_Opts_Name[] = "no-load-opts";
-tSCC zNotLoad_Opts_Pfx[]  = "no";
-#define zLoad_Opts_Name   (zNotLoad_Opts_Name + 3)
-/*
- *  Declare option callback procedures
- */
-#ifdef DEBUG
-  static tOptProc doOptDbug;
-#else /* not DEBUG */
-# define doOptDbug NULL
-#endif /* def/not DEBUG */
-extern tOptProc
-    optionPagedUsage;
-static tOptProc
-    doOptClientnet, doOptLess_Help, doOptMode,      doOptNosyn,
-    doOptServernet, doOptSlimit,    doOptTargetip,  doOptVersion,
-    doOptWait,      doUsageOpt;
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- *  Define the Flowreplay Option Descriptions.
- */
-static tOptDesc optDesc[ OPTION_CT ] = {
-  {  /* entry idx, value */ 0, VALUE_OPT_DBUG,
-     /* equiv idx, value */ 0, VALUE_OPT_DBUG,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ DBUG_FLAGS, 0,
-     /* last opt argumnt */ { zDbugDefaultArg },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptDbug,
-     /* desc, NAME, name */ zDbugText, zDbug_NAME, zDbug_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 1, VALUE_OPT_VERBOSE,
-     /* equiv idx, value */ 1, VALUE_OPT_VERBOSE,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ VERBOSE_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ NULL,
-     /* desc, NAME, name */ zVerboseText, zVerbose_NAME, zVerbose_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 2, VALUE_OPT_DECODE,
-     /* equiv idx, value */ 2, VALUE_OPT_DECODE,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ DECODE_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ aDecodeMustList, NULL,
-     /* option proc      */ NULL,
-     /* desc, NAME, name */ zDecodeText, zDecode_NAME, zDecode_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 3, VALUE_OPT_MODE,
-     /* equiv idx, value */ 3, VALUE_OPT_MODE,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 1, 1, 0,
-     /* opt state flags  */ MODE_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptMode,
-     /* desc, NAME, name */ zModeText, zMode_NAME, zMode_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 4, VALUE_OPT_WAIT,
-     /* equiv idx, value */ 4, VALUE_OPT_WAIT,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ WAIT_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptWait,
-     /* desc, NAME, name */ zWaitText, zWait_NAME, zWait_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 5, VALUE_OPT_TARGETIP,
-     /* equiv idx, value */ 5, VALUE_OPT_TARGETIP,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 1, 1, 0,
-     /* opt state flags  */ TARGETIP_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptTargetip,
-     /* desc, NAME, name */ zTargetipText, zTargetip_NAME, zTargetip_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 6, VALUE_OPT_FILTER,
-     /* equiv idx, value */ 6, VALUE_OPT_FILTER,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ FILTER_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ NULL,
-     /* desc, NAME, name */ zFilterText, zFilter_NAME, zFilter_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 7, VALUE_OPT_CLIENTNET,
-     /* equiv idx, value */ 7, VALUE_OPT_CLIENTNET,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ CLIENTNET_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptClientnet,
-     /* desc, NAME, name */ zClientnetText, zClientnet_NAME, zClientnet_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 8, VALUE_OPT_SERVERNET,
-     /* equiv idx, value */ 8, VALUE_OPT_SERVERNET,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ SERVERNET_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptServernet,
-     /* desc, NAME, name */ zServernetText, zServernet_NAME, zServernet_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 9, VALUE_OPT_NOSYN,
-     /* equiv idx, value */ 9, VALUE_OPT_NOSYN,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ NOSYN_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptNosyn,
-     /* desc, NAME, name */ zNosynText, zNosyn_NAME, zNosyn_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 10, VALUE_OPT_SLIMIT,
-     /* equiv idx, value */ 10, VALUE_OPT_SLIMIT,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ SLIMIT_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptSlimit,
-     /* desc, NAME, name */ zSlimitText, zSlimit_NAME, zSlimit_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 11, VALUE_OPT_VERSION,
-     /* equiv idx, value */ 11, VALUE_OPT_VERSION,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ VERSION_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptVersion,
-     /* desc, NAME, name */ zVersionText, zVersion_NAME, zVersion_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ 12, VALUE_OPT_LESS_HELP,
-     /* equiv idx, value */ 12, VALUE_OPT_LESS_HELP,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ LESS_HELP_FLAGS, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doOptLess_Help,
-     /* desc, NAME, name */ zLess_HelpText, zLess_Help_NAME, zLess_Help_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
-     /* equiv idx value  */ NO_EQUIVALENT, 0,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ doUsageOpt,
-     /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
-     /* equiv idx value  */ NO_EQUIVALENT, 0,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL,  NULL,
-     /* option proc      */ optionPagedUsage,
-     /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
-     /* equiv idx value  */ NO_EQUIVALENT, 0,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, 1, 0,
-     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
-                          | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL,  NULL,
-     /* option proc      */ NULL,
-     /* desc, NAME, name */ zSave_OptsText, NULL, zSave_Opts_Name,
-     /* disablement strs */ NULL, NULL },
-
-  {  /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
-     /* equiv idx value  */ NO_EQUIVALENT, 0,
-     /* equivalenced to  */ NO_EQUIVALENT,
-     /* min, max, act ct */ 0, NOLIMIT, 0,
-     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \
-			  | OPTST_DISABLE_IMM, 0,
-     /* last opt argumnt */ { NULL },
-     /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
-     /* option proc      */ optionLoadOpt,
-     /* desc, NAME, name */ zLoad_OptsText, zLoad_Opts_NAME, zLoad_Opts_Name,
-     /* disablement strs */ zNotLoad_Opts_Name, zNotLoad_Opts_Pfx }
-};
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- *  Define the Flowreplay Option Environment
- */
-tSCC   zPROGNAME[]   = "FLOWREPLAY";
-tSCC   zUsageTitle[] =
-"flowreplay (flowreplay) - Connect to servers based on network traffic stored in pcap files\n\
-USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <pcap_file(s)>\n";
-tSCC   zRcName[]     = ".flowreplayrc";
-tSCC*  apzHomeList[] = {
-       "$$/",
-       NULL };
-
-#define zBugsAddr NULL
-tSCC   zExplain[]     = "\n\
-flowreplay is a tool for using network traffic stored in pcap(3) files as\n\
-the basis for replaying connections to servers.\n";
-tSCC    zDetail[]     = "\n\
-Please note that flowreplay is currently in *alpha*.  As such, it is still\n\
-very much a work in progress and currently will not work for most uses.  If\n\
-you have the skill and interest to help make flowreplay work better, please\n\
-contact Aaron Turner.\n\n\
-For more details, please see the Tcpreplay Manual at:\n\
-http://tcpreplay.synfin.net/trac/wiki/manual\n";
-#define zFullVersion    NULL
-/* extracted from /opt/local/share/autogen/optcode.tpl near line 428 */
-
-#if defined(ENABLE_NLS)
-# define OPTPROC_BASE OPTPROC_TRANSLATE
-  static tOptionXlateProc translate_option_strings;
-#else
-# define OPTPROC_BASE OPTPROC_NONE
-# define translate_option_strings NULL
-#endif /* ENABLE_NLS */
-
-#define flowreplay_full_usage NULL
-#define flowreplay_short_usage NULL
-tOptions flowreplayOptions = {
-    OPTIONS_STRUCT_VERSION,
-    0, NULL,                    /* original argc + argv    */
-    ( OPTPROC_BASE
-    + OPTPROC_ERRSTOP
-    + OPTPROC_SHORTOPT
-    + OPTPROC_LONGOPT
-    + OPTPROC_NO_REQ_OPT
-    + OPTPROC_ARGS_REQ
-    + OPTPROC_GNUUSAGE
-    + OPTPROC_HAS_IMMED ),
-    0, NULL,                    /* current option index, current option */
-    NULL,         NULL,         zPROGNAME,
-    zRcName,      zCopyright,   zCopyrightNotice,
-    zFullVersion, apzHomeList,  zUsageTitle,
-    zExplain,     zDetail,      optDesc,
-    zBugsAddr,                  /* address to send bugs to */
-    NULL, NULL,                 /* extensions/saved state  */
-    optionUsage,       /* usage procedure */
-    translate_option_strings,   /* translation procedure */
-    /*
-     *  Indexes to special options
-     */
-    { INDEX_OPT_MORE_HELP,
-      INDEX_OPT_SAVE_OPTS,
-      NO_EQUIVALENT /* index of '-#' option */,
-      4 /* index of default opt */
-    },
-    17 /* full option count */, 13 /* user option count */,
-    flowreplay_full_usage, flowreplay_short_usage
-};
-
-/*
- *  Create the static procedure(s) declared above.
- */
-static void
-doUsageOpt(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    USAGE( EXIT_SUCCESS );
-}
-
-/* * * * * * *
- *
- *   For the dbug option, when DEBUG is #define-d.
- */
-#ifdef DEBUG
-static void
-doOptDbug(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    static const struct {const int rmin, rmax;} rng[ 1 ] = {
-        { 0, 5 } };
-    int val;
-    int ix;
-    char const* pzIndent = "\t\t\t\t  ";
-    extern FILE* option_usage_fp;
-
-    if (pOptDesc == NULL) /* usage is requesting range list
-                             option_usage_fp has already been set */
-        goto emit_ranges;
-
-    val = atoi( pOptDesc->optArg.argString );
-    for (ix = 0; ix < 1; ix++) {
-        if (val < rng[ix].rmin)
-            continue;  /* ranges need not be ordered. */
-        if (val == rng[ix].rmin)
-            goto valid_return;
-        if (rng[ix].rmax == INT_MIN)
-            continue;
-        if (val <= rng[ix].rmax)
-            goto valid_return;
-    }
-
-    option_usage_fp = stderr;
-    fprintf(stderr, _("%s error:  %s option value ``%s''is out of range.\n"),
-            pOptions->pzProgName, pOptDesc->pz_Name, pOptDesc->optArg.argString);
-    pzIndent = "\t";
-
-  emit_ranges:
-    fprintf( option_usage_fp, _("%sit must lie in the range: %d to %d\n"),
-             pzIndent, rng[0].rmin, rng[0].rmax );
-    if (pOptDesc == NULL)
-        return;
-
-    USAGE( EXIT_FAILURE );
-    /* NOTREACHED */
-    return;
-
-  valid_return:
-    pOptDesc->optArg.argInt = val;
-}
-#endif /* defined DEBUG */
-
-/* * * * * * *
- *
- *   For the mode option.
- */
-static void
-doOptMode(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    /* extracted from flowreplay_opts.def, line 126 */
-
-if (strcasecmp(OPT_ARG(MODE), "send") == 0) {
-options.sendmode = MODE_SEND;
-} else if (strcasecmp(OPT_ARG(MODE), "wait") == 0) {
-options.sendmode = MODE_WAIT;
-} else if (strcasecmp(OPT_ARG(MODE), "bytes") == 0) {
-options.sendmode = MODE_BYTES;
-} else if (strcasecmp(OPT_ARG(MODE), "user") == 0) {
-options.sendmode = MODE_USER;
-} else {
-errx(1, "Invalid --mode: %s", OPT_ARG(MODE));
-}
-
-}
-
-/* * * * * * *
- *
- *   For the wait option.
- */
-static void
-doOptWait(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    /* extracted from flowreplay_opts.def, line 155 */
-
-float2timer(atof(OPT_ARG(WAIT)), &options.timeout);
-
-}
-
-/* * * * * * *
- *
- *   For the targetip option.
- */
-static void
-doOptTargetip(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    /* extracted from flowreplay_opts.def, line 169 */
-
-#ifdef INET_ATON
-if (inet_aton(OPT_ARG(TARGETIP), &options.targetaddr) == 0)
-errx(1, "Invalid target IP address: %s", OPT_ARG(TARGETIP));
-#else
-if ((options.targetaddr.s_addr = inet_addr(OPT_ARG(TARGETIP))) == -1)
-errx(1, "Invalid target IP address: %s", OPT_ARG(TARGETIP));
-#endif
-
-}
-
-/* * * * * * *
- *
- *   For the clientnet option.
- */
-static void
-doOptClientnet(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    /* extracted from flowreplay_opts.def, line 198 */
-  
-    char *cidr = safe_strdup(OPT_ARG(CLIENTNET));
-    if (!parse_cidr(&options.clients, cidr, ","))
-        errx(1, "Unable to parse CIDR: %s", OPT_ARG(CLIENTNET));
-    free(cidr);
-
-}
-
-/* * * * * * *
- *
- *   For the servernet option.
- */
-static void
-doOptServernet(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    /* extracted from flowreplay_opts.def, line 214 */
-
-char *cidr = safe_strdup(OPT_ARG(SERVERNET));
-if (!parse_cidr(&options.servers, cidr, ","))
-errx(1, "Unable to parse CIDR: %s", OPT_ARG(SERVERNET));
-free(cidr);
-
-}
-
-/* * * * * * *
- *
- *   For the nosyn option.
- */
-static void
-doOptNosyn(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    /* extracted from flowreplay_opts.def, line 228 */
-
-options.nosyn = 1;
-
-}
-
-/* * * * * * *
- *
- *   For the slimit option.
- */
-static void
-doOptSlimit(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    /* extracted from flowreplay_opts.def, line 240 */
-
-char *p_parse = NULL, *myarg;
-myarg = safe_strdup(OPT_ARG(SLIMIT));
-
-p_parse = strtok(myarg, "/");
-if (strcasecmp(p_parse, "TCP") == 0) {
-options.proto = IPPROTO_TCP;
-} else if (strcasecmp(p_parse, "UDP") == 0) {
-options.proto = IPPROTO_UDP;
-} else {
-errx(1, "Unsupported protocol: %s", p_parse);
-}
-
-/* if port is specified, set it */
-if ((p_parse = strtok(NULL, "/")))
-options.port = htons(atoi(p_parse));
-
-}
-
-/* * * * * * *
- *
- *   For the version option.
- */
-static void
-doOptVersion(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    /* extracted from flowreplay_opts.def, line 265 */
-    
-    fprintf(stderr, "flowreplay version: %s (build %s)", VERSION, svn_version());
-#ifdef DEBUG
-    fprintf(stderr, " (debug)");
-#endif
-    fprintf(stderr, "\n");
-    fprintf(stderr, "Copyright 2001-2007 by Aaron Turner <aturner at synfin dot net>\n");
-#ifdef HAVE_LIBNET
-    fprintf(stderr, "Compiled against libnet: %s\n", LIBNET_VERSION);
-#else
-fprintf(stderr, "Not compiled with libnet.\n");
-#endif
-#ifdef HAVE_WINPCAP
-fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
-#else
-    fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
-#endif
-#ifdef ENABLE_64BITS
-    fprintf(stderr, "64 bit packet counters: enabled\n");
-#else
-    fprintf(stderr, "64 bit packet counters: disabled\n");
-#endif
-#ifdef ENABLE_VERBOSE
-    fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
-#else
-    fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
-#endif
-    exit(0);
-    
-}
-
-/* * * * * * *
- *
- *   For the less-help option.
- */
-static void
-doOptLess_Help(
-    tOptions*   pOptions,
-    tOptDesc*   pOptDesc )
-{
-    /* extracted from flowreplay_opts.def, line 304 */
-  
-    USAGE(EXIT_FAILURE);
-
-}
-
-/* extracted from /opt/local/share/autogen/optcode.tpl near line 537 */
-
-#if ENABLE_NLS
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <autoopts/usage-txt.h>
-
-static char* AO_gettext( char const* pz );
-static void  coerce_it(void** s);
-
-static char*
-AO_gettext( char const* pz )
-{
-    char* pzRes;
-    if (pz == NULL)
-        return NULL;
-    pzRes = _(pz);
-    if (pzRes == pz)
-        return pzRes;
-    pzRes = strdup( pzRes );
-    if (pzRes == NULL) {
-        fputs( _("No memory for duping translated strings\n"), stderr );
-        exit( EXIT_FAILURE );
-    }
-    return pzRes;
-}
-
-static void coerce_it(void** s) { *s = AO_gettext(*s); }
-#define COERSION(_f) \
-  coerce_it((void*)&(flowreplayOptions._f))
-
-/*
- *  This invokes the translation code (e.g. gettext(3)).
- */
-static void
-translate_option_strings( void )
-{
-    /*
-     *  Guard against re-translation.  It won't work.  The strings will have
-     *  been changed by the first pass through this code.  One shot only.
-     */
-    if (option_usage_text.field_ct == 0)
-        return;
-    /*
-     *  Do the translations.  The first pointer follows the field count field.
-     *  The field count field is the size of a pointer.
-     */
-    {
-        char** ppz = (char**)(void*)&(option_usage_text);
-        int    ix  = option_usage_text.field_ct;
-
-        do {
-            ppz++;
-            *ppz = AO_gettext(*ppz);
-        } while (--ix > 0);
-    }
-    option_usage_text.field_ct = 0;
-
-    {
-        tOptDesc* pOD = flowreplayOptions.pOptDesc;
-        int       ix  = flowreplayOptions.optCt;
-
-        for (;;) {
-            pOD->pzText           = AO_gettext(pOD->pzText);
-            pOD->pz_NAME          = AO_gettext(pOD->pz_NAME);
-            pOD->pz_Name          = AO_gettext(pOD->pz_Name);
-            pOD->pz_DisableName   = AO_gettext(pOD->pz_DisableName);
-            pOD->pz_DisablePfx    = AO_gettext(pOD->pz_DisablePfx);
-            if (--ix <= 0)
-                break;
-            pOD++;
-        }
-    }
-    COERSION(pzCopyright);
-    COERSION(pzCopyNotice);
-    COERSION(pzFullVersion);
-    COERSION(pzUsageTitle);
-    COERSION(pzExplain);
-    COERSION(pzDetail);
-}
-
-#endif /* ENABLE_NLS */
-
-#ifdef  __cplusplus
-}
-#endif
-/* flowreplay_opts.c ends here */

+ 0 - 309
src/flowreplay_opts.def

@@ -1,309 +0,0 @@
-autogen definitions options;
-
-
-copyright = {
-    date        = "2004-2007";
-    owner       = "Aaron Turner";
-    type        = "bsd";
-    author      = <<- EOText
-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/
-EOText;
-};
-
-package         = "flowreplay";
-prog-name       = "flowreplay";
-prog-title      = "Connect to servers based on network traffic stored in pcap files";
-long-opts;
-gnu-usage;
-help-value      = "H";
-save-opts-value = "";
-load-opts-value = "";
-argument = "<pcap_file(s)>";
-
-
-config-header   = "config.h";
-
-include         = "#include \"defines.h\"\n"
-                "#include \"flowreplay.h\"\n"
-                "#include \"common.h\"\n"
-                "#include \"config.h\"\n"
-                "extern flowreplay_opt_t options;\n";
-
-homerc          = "$$/";
-
-explain = <<- EOExplain
-flowreplay is a tool for using network traffic stored in pcap(3) files as
-the basis for replaying connections to servers.
-EOExplain;
-
-detail = <<- EODetail
-Please note that flowreplay is currently in *alpha*.  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
-EODetail;
-
-flag = {
-    ifdef       = DEBUG;
-    name        = dbug;
-    value       = d;
-    arg-type    = number;
-    max         = 1;
-    immediate;
-    arg-range   = "0->5";
-    arg-default = 0;
-    descrip     = "Enable debugging output";
-    doc         = <<- EOText
-If configured with --enable-debug, then you can specify a verbosity 
-level for debugging output.  Higher numbers increase verbosity.
-EOText;
-};
-
-/* Verbose decoding via tcpdump */
-
-flag = {
-    ifdef       = ENABLE_VERBOSE;
-    name        = verbose;
-    value       = v;
-    max         = 1;
-    immediate;
-    descrip     = "Print decoded packets via tcpdump to STDOUT";
-    settable;
-    doc         = "";
-};
-
-flag = {
-    ifdef       = ENABLE_VERBOSE;
-    name        = decode;
-    flags-must  = verbose;
-    value       = A;
-    arg-type    = string;
-    max         = 1;
-    descrip     = "Arguments passed to tcpdump decoder";
-    doc         = <<- EOText
-When enabling verbose mode (@var{-v}) you may also specify one or more
-additional  arguments to pass to @code{tcpdump} 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 ]
-EOText;
-};
-
-
-flag = {
-    name        = mode;
-    value       = m;
-    arg-type    = string;
-    max         = 1;
-    must-set;
-    descrip     = "Replay mode";
-    doc         = <<- EOText
-Flowreplay needs to know handle client/server exchanges to properly time.
-The options are:
-@table @bullet
-@item @var{send}
-Replay traffic as fast as possible.  Do not wait for server to reply.
-@item @var{wait}
-Wait @var{--wait} sec.usec for the server to reply before sending.
-@item @var{bytes}
-Wait until the server has sent the number of bytes stored in the pcap file.
-@item @var{user}
-Send packets based on user interaction.
-@end table
-EOText;
-	flag-code	= <<- EOText
-
-	if (strcasecmp(OPT_ARG(MODE), "send") == 0) {
-		options.sendmode = MODE_SEND;
-	} else if (strcasecmp(OPT_ARG(MODE), "wait") == 0) {
-		options.sendmode = MODE_WAIT;
-	} else if (strcasecmp(OPT_ARG(MODE), "bytes") == 0) {
-		options.sendmode = MODE_BYTES;
-	} else if (strcasecmp(OPT_ARG(MODE), "user") == 0) {
-		options.sendmode = MODE_USER;
-	} else {
-		errx(1, "Invalid --mode: %s", OPT_ARG(MODE));
-	}
-
-EOText;
-};
-    
-flag = {
-    name        = wait;
-    value       = w;
-    arg-type    = string;
-    max         = 1;
-    default     = "2.0";
-    descrip     = "Number of sec.usec to wait between client's turn to send";
-    doc         = <<- EOText
-If @var{--mode} is @var{wait}, 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.
-EOText;
-	flag-code	= <<- EOText
-
-	float2timer(atof(OPT_ARG(WAIT)), &options.timeout);
-
-EOText;
-};
-
-flag = {
-	name		= targetip;
-	value		= t;
-	arg-type	= string;
-	max			= 1;
-	must-set;
-	descrip		= "Target host to connect to";
-	flag-code	= <<- EOText
-
-#ifdef INET_ATON
-	if (inet_aton(OPT_ARG(TARGETIP), &options.targetaddr) == 0)
-		errx(1, "Invalid target IP address: %s", OPT_ARG(TARGETIP));
-#else
-	if ((options.targetaddr.s_addr = inet_addr(OPT_ARG(TARGETIP))) == -1)
-		errx(1, "Invalid target IP address: %s", OPT_ARG(TARGETIP));
-#endif
-
-EOText;
-};
-
-
-
-flag = {
-    name        = filter;
-    value       = f;
-    arg-type    = string;
-    max         = 1;
-    descrip     = "BPF filter to limit which flows are replayed";
-    doc         = "";
-};
-
-flag = {
-	name 		= clientnet;
-	value		= c;
-	arg-type	= string;
-	descrip		= "Client network(s)";
-	flag-code	= <<- EOText
-  
-    char *cidr = safe_strdup(OPT_ARG(CLIENTNET));
-    if (!parse_cidr(&options.clients, cidr, ","))
-        errx(1, "Unable to parse CIDR: %s", OPT_ARG(CLIENTNET));
-    free(cidr);
-
-EOText;
-};
-
-
-flag = {
-	name		= servernet;
-	value		= s;
-	arg-type	= string;
-	descrip		= "Server network(s)";
-	flag-code	= <<- EOText
-
-	char *cidr = safe_strdup(OPT_ARG(SERVERNET));
-	if (!parse_cidr(&options.servers, cidr, ","))
-		errx(1, "Unable to parse CIDR: %s", OPT_ARG(SERVERNET));
-	free(cidr);
-
-EOText;
-};
-
-flag = {
-	name		= nosyn;
-	value		= n;
-	descrip		= "Disable Syn packet requirement to start connections";
-	flag-code	= <<- EOText
-
-options.nosyn = 1;
-
-EOText;
-};
-
-flag = {
-	name		= slimit;
-	value		= l;
-	descrip		= "Service limit to proto/port";
-	arg-type	= string;
-	flag-code	= <<- EOText
-
-	char *p_parse = NULL, *myarg;
-	myarg = safe_strdup(OPT_ARG(SLIMIT));
-
-	p_parse = strtok(myarg, "/");
-	if (strcasecmp(p_parse, "TCP") == 0) {
-		options.proto = IPPROTO_TCP;
-	} else if (strcasecmp(p_parse, "UDP") == 0) {
-		options.proto = IPPROTO_UDP;
-	} else {
-		errx(1, "Unsupported protocol: %s", p_parse);
-	}
-
-	/* if port is specified, set it */
-	if ((p_parse = strtok(NULL, "/")))
-		options.port = htons(atoi(p_parse));
-	
-EOText;
-};
-
-flag = {
-    name        = version;
-    value       = V;
-    descrip     = "Print version information";
-    flag-code   = <<- EOVersion
-    
-    fprintf(stderr, "flowreplay version: %s (build %s)", VERSION, svn_version());
-#ifdef DEBUG
-    fprintf(stderr, " (debug)");
-#endif
-    fprintf(stderr, "\n");
-    fprintf(stderr, "Copyright 2001-2007 by Aaron Turner <aturner at synfin dot net>\n");
-#ifdef HAVE_LIBNET
-    fprintf(stderr, "Compiled against libnet: %s\n", LIBNET_VERSION);
-#else
-	fprintf(stderr, "Not compiled with libnet.\n");
-#endif
-#ifdef HAVE_WINPCAP
-	fprintf(stderr, "Compiled against winpcap: %s\n", get_pcap_version());
-#else
-    fprintf(stderr, "Compiled against libpcap: %s\n", get_pcap_version());
-#endif
-#ifdef ENABLE_64BITS
-    fprintf(stderr, "64 bit packet counters: enabled\n");
-#else
-    fprintf(stderr, "64 bit packet counters: disabled\n");
-#endif
-#ifdef ENABLE_VERBOSE
-    fprintf(stderr, "Verbose printing via tcpdump: enabled\n");
-#else
-    fprintf(stderr, "Verbose printing via tcpdump: disabled\n");
-#endif
-    exit(0);
-    
-EOVersion;
-    doc         = "";
-};
-
-flag = {
-    name        = less-help;
-    value       = "h";
-    immediate;
-    descrip     = "Display less usage information and exit";
-    flag-code   = <<- EOHelp
-  
-    USAGE(EXIT_FAILURE);
-
-EOHelp;
-    doc         = "";
-};

+ 0 - 198
src/flowreplay_opts.h

@@ -1,198 +0,0 @@
-/*   -*- buffer-read-only: t -*- vi: set ro:
- *  
- *  DO NOT EDIT THIS FILE   (flowreplay_opts.h)
- *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:04 PM PDT
- *  From the definitions    flowreplay_opts.def
- *  and the template file   options
- *
- * Generated from AutoOpts 30:0:5 templates.
- */
-
-/*
- *  This file was produced by an AutoOpts template.  AutoOpts is a
- *  copyrighted work.  This header file is not encumbered by AutoOpts
- *  licensing, but is provided under the licensing terms chosen by the
- *  flowreplay author or copyright holder.  AutoOpts is licensed under
- *  the terms of the LGPL.  The redistributable library (``libopts'') is
- *  licensed under the terms of either the LGPL or, at the users discretion,
- *  the BSD license.  See the AutoOpts and/or libopts sources for details.
- *
- * This source file is copyrighted and licensed under the following terms:
- *
- * flowreplay copyright 2004-2007 Aaron Turner - all rights reserved
- *
- * flowreplay is free software copyrighted by Aaron Turner.
- * 
- * 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 name ``Aaron Turner'' nor the name of any other
- *    contributor may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- * 
- * flowreplay IS PROVIDED BY Aaron Turner ``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 Aaron Turner OR ANY OTHER CONTRIBUTORS
- * 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.
- */
-/*
- *  This file contains the programmatic interface to the Automated
- *  Options generated for the flowreplay program.
- *  These macros are documented in the AutoGen info file in the
- *  "AutoOpts" chapter.  Please refer to that doc for usage help.
- */
-#ifndef AUTOOPTS_FLOWREPLAY_OPTS_H_GUARD
-#define AUTOOPTS_FLOWREPLAY_OPTS_H_GUARD 1
-#include "config.h"
-#include <autoopts/options.h>
-
-/*
- *  Ensure that the library used for compiling this generated header is at
- *  least as new as the version current when the header template was released
- *  (not counting patch version increments).  Also ensure that the oldest
- *  tolerable version is at least as old as what was current when the header
- *  template was released.
- */
-#define AO_TEMPLATE_VERSION 122880
-#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
- || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
-# error option template version mismatches autoopts/options.h header
-  Choke Me.
-#endif
-
-/*
- *  Enumeration of each option:
- */
-typedef enum {
-        INDEX_OPT_DBUG             =  0,
-        INDEX_OPT_VERBOSE          =  1,
-        INDEX_OPT_DECODE           =  2,
-        INDEX_OPT_MODE             =  3,
-        INDEX_OPT_WAIT             =  4,
-        INDEX_OPT_TARGETIP         =  5,
-        INDEX_OPT_FILTER           =  6,
-        INDEX_OPT_CLIENTNET        =  7,
-        INDEX_OPT_SERVERNET        =  8,
-        INDEX_OPT_NOSYN            =  9,
-        INDEX_OPT_SLIMIT           = 10,
-        INDEX_OPT_VERSION          = 11,
-        INDEX_OPT_LESS_HELP        = 12,
-        INDEX_OPT_HELP             = 13,
-        INDEX_OPT_MORE_HELP        = 14,
-        INDEX_OPT_SAVE_OPTS        = 15,
-        INDEX_OPT_LOAD_OPTS        = 16
-} teOptIndex;
-
-#define OPTION_CT    17
-
-/*
- *  Interface defines for all options.  Replace "n" with the UPPER_CASED
- *  option name (as in the teOptIndex enumeration above).
- *  e.g. HAVE_OPT( DBUG )
- */
-#define         DESC(n) (flowreplayOptions.pOptDesc[INDEX_OPT_## n])
-#define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
-#define      OPT_ARG(n) (DESC(n).optArg.argString)
-#define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
-#define    COUNT_OPT(n) (DESC(n).optOccCt)
-#define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
-#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
-#define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
-#define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
-#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
-#define    CLEAR_OPT(n) STMTS( \
-                DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
-                if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
-                    DESC(n).fOptState |= OPTST_DISABLED; \
-                DESC(n).optCookie = NULL )
-
-/*
- *  Interface defines for specific options.
- */
-#ifdef DEBUG
-#define VALUE_OPT_DBUG           'd'
-#define OPT_VALUE_DBUG           (DESC(DBUG).optArg.argInt)
-#endif /* DEBUG */
-#ifdef ENABLE_VERBOSE
-#define VALUE_OPT_VERBOSE        'v'
-#define SET_OPT_VERBOSE   STMTS( \
-        DESC(VERBOSE).optActualIndex = 1; \
-        DESC(VERBOSE).optActualValue = VALUE_OPT_VERBOSE; \
-        DESC(VERBOSE).fOptState &= OPTST_PERSISTENT_MASK; \
-        DESC(VERBOSE).fOptState |= OPTST_SET )
-#endif /* ENABLE_VERBOSE */
-#ifdef ENABLE_VERBOSE
-#define VALUE_OPT_DECODE         'A'
-#endif /* ENABLE_VERBOSE */
-#define VALUE_OPT_MODE           'm'
-#define VALUE_OPT_WAIT           'w'
-#define VALUE_OPT_TARGETIP       't'
-#define VALUE_OPT_FILTER         'f'
-#define VALUE_OPT_CLIENTNET      'c'
-#define VALUE_OPT_SERVERNET      's'
-#define VALUE_OPT_NOSYN          'n'
-#define VALUE_OPT_SLIMIT         'l'
-#define VALUE_OPT_VERSION        'V'
-#define VALUE_OPT_LESS_HELP      'h'
-
-#define VALUE_OPT_HELP          'H'
-#define VALUE_OPT_MORE_HELP     '!'
-#define VALUE_OPT_SAVE_OPTS     INDEX_OPT_SAVE_OPTS
-#define VALUE_OPT_LOAD_OPTS     INDEX_OPT_LOAD_OPTS
-#define SET_OPT_SAVE_OPTS(a)   STMTS( \
-        DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
-        DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
-        DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
-/*
- *  Interface defines not associated with particular options
- */
-#define ERRSKIP_OPTERR  STMTS( flowreplayOptions.fOptSet &= ~OPTPROC_ERRSTOP )
-#define ERRSTOP_OPTERR  STMTS( flowreplayOptions.fOptSet |= OPTPROC_ERRSTOP )
-#define RESTART_OPT(n)  STMTS( \
-                flowreplayOptions.curOptIdx = (n); \
-                flowreplayOptions.pzCurOpt  = NULL )
-#define START_OPT       RESTART_OPT(1)
-#define USAGE(c)        (*flowreplayOptions.pUsageProc)( &flowreplayOptions, c )
-/* extracted from /opt/local/share/autogen/opthead.tpl near line 380 */
-
-/* * * * * *
- *
- *  Declare the flowreplay option descriptor.
- */
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-extern tOptions   flowreplayOptions;
-
-#ifndef _
-#  if ENABLE_NLS
-#    include <stdio.h>
-     static inline char* aoGetsText( char const* pz ) {
-         if (pz == NULL) return NULL;
-         return (char*)gettext( pz );
-     }
-#    define _(s)  aoGetsText(s)
-#  else  /* ENABLE_NLS */
-#    define _(s)  s
-#  endif /* ENABLE_NLS */
-#endif
-
-#ifdef  __cplusplus
-}
-#endif
-#endif /* AUTOOPTS_FLOWREPLAY_OPTS_H_GUARD */
-/* flowreplay_opts.h ends here */

+ 2 - 2
src/tcpbridge.1

@@ -1,7 +1,7 @@
-.TH TCPBRIDGE 1 2007-08-26 "(tcpbridge )" "Programmer's Manual"
+.TH TCPBRIDGE 1 2007-10-25 "(tcpbridge )" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (tcpbridge.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:05 PM PDT
+.\"  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:13 PM PDT
 .\"  From the definitions    tcpbridge_opts.def
 .\"  and the template file   agman1.tpl
 .\"

+ 1 - 1
src/tcpbridge_opts.c

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpbridge_opts.c)
  *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:04 PM PDT
+ *  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:12 PM PDT
  *  From the definitions    tcpbridge_opts.def
  *  and the template file   options
  *

+ 1 - 1
src/tcpbridge_opts.h

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpbridge_opts.h)
  *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:04 PM PDT
+ *  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:12 PM PDT
  *  From the definitions    tcpbridge_opts.def
  *  and the template file   options
  *

+ 6 - 6
src/tcpedit/plugins/dlt_en10mb/en10mb.c

@@ -1,4 +1,4 @@
-/* $Id: en10mb.c 1893 2007-08-10 04:24:50Z aturner $ */
+/* $Id: en10mb.c 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -303,7 +303,7 @@ dlt_en10mb_decode(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
     extra->vlan = 0;
     
     /* get the L3 protocol type  & L2 len*/
-    switch (eth->ether_type) {
+    switch (ntohs(eth->ether_type)) {
         case ETHERTYPE_VLAN:
             vlan = (struct tcpr_802_1q_hdr *)packet;
             ctx->proto = vlan->vlan_len;
@@ -517,14 +517,14 @@ dlt_en10mb_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
     assert(pktlen);
     
     eth = (struct tcpr_ethernet_hdr *)packet;
-    switch (eth->ether_type) {
+    switch (ntohs(eth->ether_type)) {
         case ETHERTYPE_VLAN:
             vlan = (struct tcpr_802_1q_hdr *)packet;
-            return ntohs(vlan->vlan_len);
+            return vlan->vlan_len;
             break;
         
         default:
-            return ntohs(eth->ether_type);
+            return eth->ether_type;
             break;
     }
     return TCPEDIT_ERROR;
@@ -608,7 +608,7 @@ dlt_en10mb_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
     assert(pktlen);
     
     eth = (struct tcpr_ethernet_hdr *)packet;
-    switch (eth->ether_type) {
+    switch (ntohs(eth->ether_type)) {
         case ETHERTYPE_VLAN:
             return 18;
             break;

+ 2 - 2
src/tcpedit/plugins/dlt_hdlc/hdlc.c

@@ -1,4 +1,4 @@
-/* $Id: hdlc.c 1893 2007-08-10 04:24:50Z aturner $ */
+/* $Id: hdlc.c 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -296,7 +296,7 @@ dlt_hdlc_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
     
     hdlc = (cisco_hdlc_t *)packet;
     
-    return ntohs(hdlc->protocol);
+    return hdlc->protocol;
 }
 
 /*

+ 2 - 4
src/tcpedit/plugins/dlt_ieee80211/ieee80211.c

@@ -1,4 +1,4 @@
-/* $Id: ieee80211.c 1893 2007-08-10 04:24:50Z aturner $ */
+/* $Id: ieee80211.c 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -236,8 +236,6 @@ dlt_ieee80211_encode(tcpeditdlt_t *ctx, u_char **packet_ex, int pktlen, _U_ tcpr
 
 /*
  * Function returns the Layer 3 protocol type of the given packet, or TCPEDIT_ERROR on error
- * Make sure you return this in host byte order since all the comparisions will be
- * against the ETHERTYPE_* values which are oddly in host byte order.
  */
 int 
 dlt_ieee80211_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
@@ -253,7 +251,7 @@ dlt_ieee80211_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
     
     protocol = (u_int16_t)packet[l2len - 2];
     
-    return ntohs(protocol);
+    return protocol;
 }
 
 /*

+ 2 - 2
src/tcpedit/plugins/dlt_linuxsll/linuxsll.c

@@ -1,4 +1,4 @@
-/* $Id: linuxsll.c 1893 2007-08-10 04:24:50Z aturner $ */
+/* $Id: linuxsll.c 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -237,7 +237,7 @@ dlt_linuxsll_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
 
     linux_sll = (linux_sll_header_t *)packet;
     
-    return ntohs(linux_sll->proto);
+    return linux_sll->proto;
 }
 
 /*

+ 2 - 2
src/tcpedit/plugins/dlt_null/null.c

@@ -1,4 +1,4 @@
-/* $Id: null.c 1893 2007-08-10 04:24:50Z aturner $ */
+/* $Id: null.c 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -257,7 +257,7 @@ dlt_null_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
         return TCPEDIT_ERROR;
     }
     
-    return protocol; 
+    return htons(protocol);
 }
 
 /*

+ 2 - 2
src/tcpedit/plugins/dlt_raw/raw.c

@@ -1,4 +1,4 @@
-/* $Id: raw.c 1893 2007-08-10 04:24:50Z aturner $ */
+/* $Id: raw.c 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -243,7 +243,7 @@ dlt_raw_proto(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen)
         return TCPEDIT_ERROR;
     }
     
-    return protocol; 
+    return htons(protocol);
 }
 
 /*

+ 25 - 25
src/tcpedit/tcpedit.c

@@ -1,4 +1,4 @@
-/* $Id: tcpedit.c 1895 2007-08-22 04:24:33Z aturner $ */
+/* $Id: tcpedit.c 1921 2007-10-25 18:18:50Z aturner $ */
 
 /*
  * Copyright (c) 2001-2007 Aaron Turner.
@@ -83,24 +83,24 @@ tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr,
     assert(*pktdata);
     assert(tcpedit->validated);
 
- 
+
     tcpedit->runtime.packetnum++;
     dbgx(2, "packet " COUNTER_SPEC " caplen %d", 
             tcpedit->runtime.packetnum, (*pkthdr)->caplen);
-            
-   /* 
-     * if we are padding out the packet, we need to move the packet 
-     * data to a different buffer because the incoming **pktdata buffer
-     * most likely isn't big enough for the extra padding
+
+    /* 
+     * copy over our packet data.  Necessary because many options like padding or 
+     * adding VLAN tags makes the packet size increase and we'll get segfaults 
+     * later on
      */
-    if (HAVE_OPT(FIXLEN) && strcmp(OPT_ARG(FIXLEN), "pad") == 0) {
-        /* allocate our buffer the first time */
-        if (packet == NULL)
-            packet = safe_malloc(MAX_SNAPLEN);
-    
-        memcpy(packet, *pktdata, (*pkthdr)->caplen);
-        *pktdata = packet;
-    }
+            
+    /* allocate our buffer the first time */
+    if (packet == NULL)
+        packet = safe_malloc(MAX_SNAPLEN);
+
+    /* and copy over the packet data... */
+    memcpy(packet, *pktdata, (*pkthdr)->caplen);
+    *pktdata = packet;
     
     /*
      * remove the Ethernet FCS (checksum)?
@@ -131,10 +131,10 @@ tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr,
     l2len = tcpedit_dlt_l2len(tcpedit->dlt_ctx, dlt, *pktdata, (*pkthdr)->caplen);
 
     /* does packet have an IP header?  if so set our pointer to it */
-    if (l2proto == ETHERTYPE_IP) {
+    if (l2proto == htons(ETHERTYPE_IP)) {
         ip_hdr = (ipv4_hdr_t *)tcpedit_dlt_l3data(tcpedit->dlt_ctx, dlt, *pktdata, (*pkthdr)->caplen);
         if (ip_hdr == NULL) {
-            return -1;
+            return TCPEDIT_ERROR;
         }        
         dbg(3, "Packet has an IPv4 header...");
     } else {
@@ -148,33 +148,33 @@ tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr,
         /* IP packets */
         if (ip_hdr != NULL) {
             if ((retval = rewrite_ipv4l3(tcpedit, ip_hdr, direction)) < 0)
-                return -1;
+                return TCPEDIT_ERROR;
             needtorecalc += retval;
         }
 
         /* ARP packets */
-        else if (l2proto == ETHERTYPE_ARP) {
+        else if (l2proto == htons(ETHERTYPE_ARP)) {
             arp_hdr = (arp_hdr_t *)(&(*pktdata)[l2len]);
             /* unlike, rewrite_ipl3, we don't care if the packet changed
              * because we never need to recalc the checksums for an ARP
              * packet.  So ignore the return value
              */
             if (rewrite_iparp(tcpedit, arp_hdr, direction) < 0)
-                return -1;
+                return TCPEDIT_ERROR;
         }
     }
 
     /* rewrite ports */
     if (tcpedit->portmap != NULL && (ip_hdr != NULL)) {
         if ((retval = rewrite_ports(tcpedit, &ip_hdr)) < 0)
-            return -1;
+            return TCPEDIT_ERROR;
         needtorecalc += retval;
     }
 
     /* Untruncate packet? Only for IP packets */
     if ((tcpedit->fixlen) && (ip_hdr != NULL)) {
         if ((retval = untrunc_packet(tcpedit, *pkthdr, *pktdata, ip_hdr)) < 0)
-            return -1;
+            return TCPEDIT_ERROR;
         needtorecalc += retval;
     }
 
@@ -184,17 +184,17 @@ tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr,
         if (ip_hdr != NULL) {
             if ((retval = randomize_ipv4(tcpedit, *pkthdr, *pktdata, 
                     ip_hdr)) < 0)
-                return -1;
+                return TCPEDIT_ERROR;
             needtorecalc += retval;
         } else {
             if (direction == TCPR_DIR_C2S) {
                 if (randomize_iparp(tcpedit, *pkthdr, *pktdata, 
                         tcpedit->runtime.dlt1) < 0)
-                    return -1;
+                    return TCPEDIT_ERROR;
             } else {
                 if (randomize_iparp(tcpedit, *pkthdr, *pktdata, 
                         tcpedit->runtime.dlt2) < 0)
-                    return -1;
+                    return TCPEDIT_ERROR;
             }
         }
     }

+ 1 - 1
src/tcpedit/tcpedit_stub.h

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpedit_stub.h)
  *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:06 PM PDT
+ *  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:14 PM PDT
  *  From the definitions    tcpedit_stub.def
  *  and the template file   options
  *

+ 2 - 2
src/tcpprep.1

@@ -1,7 +1,7 @@
-.TH TCPPREP 1 2007-08-26 "(tcpprep )" "Programmer's Manual"
+.TH TCPPREP 1 2007-10-25 "(tcpprep )" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (tcpprep.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:04 PM PDT
+.\"  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:12 PM PDT
 .\"  From the definitions    tcpprep_opts.def
 .\"  and the template file   agman1.tpl
 .\"

+ 1 - 1
src/tcpprep_opts.c

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpprep_opts.c)
  *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:03 PM PDT
+ *  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:11 PM PDT
  *  From the definitions    tcpprep_opts.def
  *  and the template file   options
  *

+ 1 - 1
src/tcpprep_opts.h

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpprep_opts.h)
  *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:03 PM PDT
+ *  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:11 PM PDT
  *  From the definitions    tcpprep_opts.def
  *  and the template file   options
  *

+ 2 - 2
src/tcpreplay.1

@@ -1,7 +1,7 @@
-.TH TCPREPLAY 1 2007-08-26 "(tcpreplay )" "Programmer's Manual"
+.TH TCPREPLAY 1 2007-10-25 "(tcpreplay )" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (tcpreplay.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:04 PM PDT
+.\"  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:12 PM PDT
 .\"  From the definitions    tcpreplay_opts.def
 .\"  and the template file   agman1.tpl
 .\"

+ 1 - 1
src/tcpreplay_opts.c

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpreplay_opts.c)
  *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:03 PM PDT
+ *  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:11 PM PDT
  *  From the definitions    tcpreplay_opts.def
  *  and the template file   options
  *

+ 1 - 1
src/tcpreplay_opts.h

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpreplay_opts.h)
  *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:03 PM PDT
+ *  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:10 PM PDT
  *  From the definitions    tcpreplay_opts.def
  *  and the template file   options
  *

+ 2 - 2
src/tcprewrite.1

@@ -1,7 +1,7 @@
-.TH TCPREWRITE 1 2007-08-26 "(tcprewrite )" "Programmer's Manual"
+.TH TCPREWRITE 1 2007-10-25 "(tcprewrite )" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (tcprewrite.1)
 .\"  
-.\"  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:05 PM PDT
+.\"  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:12 PM PDT
 .\"  From the definitions    tcprewrite_opts.def
 .\"  and the template file   agman1.tpl
 .\"

+ 1 - 1
src/tcprewrite_opts.c

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcprewrite_opts.c)
  *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:03 PM PDT
+ *  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:11 PM PDT
  *  From the definitions    tcprewrite_opts.def
  *  and the template file   options
  *

+ 1 - 1
src/tcprewrite_opts.h

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcprewrite_opts.h)
  *  
- *  It has been AutoGen-ed  Sunday August 26, 2007 at 01:08:03 PM PDT
+ *  It has been AutoGen-ed  Thursday October 25, 2007 at 12:23:11 PM PDT
  *  From the definitions    tcprewrite_opts.def
  *  and the template file   options
  *

+ 3 - 6
tcpreplay.spec.in

@@ -1,4 +1,4 @@
-# $Id: tcpreplay.spec.in 1762 2007-03-24 20:42:05Z aturner $
+# $Id: tcpreplay.spec.in 1921 2007-10-25 18:18:50Z aturner $
 Summary: A tool to replay captured network traffic.
 Name: tcpreplay
 Version: @TCPREPLAY_VERSION@
@@ -20,8 +20,7 @@ URL: http://tcpreplay.sf.net/
 Tcpreplay is a suite of tools to edit and replay captured network traffic.
 The tcpreplay suite includes tcpprep to pre-process pcap files, tcprewrite a
 pcap editor and tcpreplay to send packets.  Also included is tcpbridge which
-is a user-space bridge and flowreplay, a client-side agent using pcap files
-as the basis of connections.
+is a user-space bridge.
 
 %prep
 %setup -q
@@ -39,13 +38,11 @@ mkdir -p $RPM_BUILD_ROOT%{_bindir}
 mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
 install -m755 src/tcpreplay $RPM_BUILD_ROOT%{_bindir} 
 install -m755 src/tcpprep $RPM_BUILD_ROOT%{_bindir} 
-install -m755 src/flowreplay $RPM_BUILD_ROOT%{_bindir}
 install -m755 src/tcpbridge $RPM_BUILD_ROOT%{_bindir}
 install -m755 src/tcprewrite $RPM_BUILD_ROOT%{_bindir}
 
 install -m644 man/tcpreplay.1 $RPM_BUILD_ROOT%{_mandir}/man1
 install -m644 man/tcpprep.1 $RPM_BUILD_ROOT%{_mandir}/man1
-install -m644 man/flowreplay.1 $RPM_BUILD_ROOT%{_mandir}/man1
 install -m644 man/tcpbridge.1 $RPM_BUILD_ROOT%{_mandir}/man1
 install -m644 man/tcprewrite.1 $RPM_BUILD_ROOT%{_mandir}/man1
 
@@ -55,7 +52,7 @@ rm -rf ${RPM_BUILD_ROOT}
 %files
 %defattr(-,root,root)
 %doc	docs/CHANGELOG docs/LICENSE docs/README docs/TODO docs/CREDIT \
-    docs/NOTES docs/INSTALL docs/FAQ.pdf docs/manual.pdf docs/flowreplay.pdf
+    docs/NOTES docs/INSTALL docs/FAQ.pdf docs/manual.pdf
 %{_bindir}/*
 %{_mandir}/man1/*
 

+ 1 - 1
test/Makefile.am

@@ -321,7 +321,7 @@ endif
 rewrite_config:
 	$(PRINTF) "%s" "[tcprewrite] Config/VLAN Add test: "
 	$(PRINTF) "%s\n" "*** [tcprewrite] Config/VLAN Add test: " >>test.log
-	$(TCPREWRITE) -i test.pcap -o test.rewrite_config1 --load-opts config
+	$(TCPREWRITE) --load-opts config
 if WORDS_BIGENDIAN
 	diff test.$@ test.$@1 >>test.log 2>&1
 else

+ 1 - 1
test/Makefile.in

@@ -629,7 +629,7 @@ rewrite_layer2:
 rewrite_config:
 	$(PRINTF) "%s" "[tcprewrite] Config/VLAN Add test: "
 	$(PRINTF) "%s\n" "*** [tcprewrite] Config/VLAN Add test: " >>test.log
-	$(TCPREWRITE) -i test.pcap -o test.rewrite_config1 --load-opts config
+	$(TCPREWRITE) --load-opts config
 @WORDS_BIGENDIAN_TRUE@	diff test.$@ test.$@1 >>test.log 2>&1
 @WORDS_BIGENDIAN_FALSE@	diff test2.$@ test.$@1 >>test.log 2>&1
 	if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi

BIN
test/test2.rewrite_vlandel