Browse Source

Import upstream version 3.3.1

Aaron Turner 16 years ago
parent
commit
16745a8624
100 changed files with 14251 additions and 6622 deletions
  1. 33 21
      Makefile.in
  2. 200 107
      aclocal.m4
  3. 7039 5929
      configure
  4. 109 28
      configure.ac
  5. 30 2
      docs/CHANGELOG
  6. 2 2
      docs/LICENSE
  7. 9 2
      docs/Makefile.in
  8. 16 10
      lib/Makefile.in
  9. 20 14
      libopts/Makefile.in
  10. 16 10
      scripts/Makefile.in
  11. BIN
      src/._Makefile.am
  12. BIN
      src/._tcpreplay_opts.def
  13. 30 12
      src/Makefile.am
  14. 117 54
      src/Makefile.in
  15. 1 0
      src/common.h
  16. BIN
      src/common/._sendpacket.c
  17. 2 2
      src/common/Makefile.am
  18. 21 14
      src/common/Makefile.in
  19. 1 1
      src/common/cache.c
  20. 5 1
      src/common/err.h
  21. 12 12
      src/common/get.c
  22. 1 1
      src/common/interface.c
  23. 79 0
      src/common/rdtsc.c
  24. 125 0
      src/common/rdtsc.h
  25. 131 53
      src/common/sendpacket.c
  26. 3 2
      src/common/sendpacket.h
  27. 1 1
      src/common/svn_version.c
  28. 12 16
      src/common/timer.c
  29. 127 10
      src/common/timer.h
  30. 1 27
      src/common/utils.c
  31. 1 2
      src/common/utils.h
  32. 12 0
      src/config.h.in
  33. 71 1
      src/defines.h
  34. 71 1
      src/defines.h.in
  35. 29 0
      src/fragroute/LICENSE
  36. 18 0
      src/fragroute/Makefile.am
  37. 794 0
      src/fragroute/Makefile.in
  38. 33 0
      src/fragroute/README
  39. 68 0
      src/fragroute/argv.c
  40. 15 0
      src/fragroute/argv.h
  41. 1592 0
      src/fragroute/bget.c
  42. 30 0
      src/fragroute/bget.h
  43. 141 0
      src/fragroute/fragroute.c
  44. 69 0
      src/fragroute/fragroute.h
  45. 183 0
      src/fragroute/mod.c
  46. 27 0
      src/fragroute/mod.h
  47. 97 0
      src/fragroute/mod_delay.c
  48. 97 0
      src/fragroute/mod_drop.c
  49. 100 0
      src/fragroute/mod_dup.c
  50. 57 0
      src/fragroute/mod_echo.c
  51. 125 0
      src/fragroute/mod_ip_chaff.c
  52. 171 0
      src/fragroute/mod_ip_frag.c
  53. 91 0
      src/fragroute/mod_ip_opt.c
  54. 69 0
      src/fragroute/mod_ip_tos.c
  55. 73 0
      src/fragroute/mod_ip_ttl.c
  56. 79 0
      src/fragroute/mod_order.c
  57. 326 0
      src/fragroute/mod_print.c
  58. 177 0
      src/fragroute/mod_tcp_chaff.c
  59. 91 0
      src/fragroute/mod_tcp_opt.c
  60. 150 0
      src/fragroute/mod_tcp_seg.c
  61. 280 0
      src/fragroute/pkt.c
  62. 79 0
      src/fragroute/pkt.h
  63. 49 0
      src/fragroute/randutil.c
  64. 14 0
      src/fragroute/randutil.h
  65. 237 101
      src/send_packets.c
  66. 101 0
      src/sleep.c
  67. 146 0
      src/sleep.h
  68. 16 3
      src/tcpbridge.1
  69. 2 2
      src/tcpbridge.c
  70. 6 1
      src/tcpbridge.h
  71. 77 55
      src/tcpbridge_opts.c
  72. 3 3
      src/tcpbridge_opts.def
  73. 47 45
      src/tcpbridge_opts.h
  74. BIN
      src/tcpedit/._dlt.c
  75. BIN
      src/tcpedit/._tcpedit.c
  76. 16 10
      src/tcpedit/Makefile.in
  77. 40 1
      src/tcpedit/edit_packet.c
  78. 3 1
      src/tcpedit/edit_packet.h
  79. 22 4
      src/tcpedit/parse_args.c
  80. BIN
      src/tcpedit/plugins/._dlt_plugins.c
  81. BIN
      src/tcpedit/plugins/._dlt_plugins.h
  82. 1 1
      src/tcpedit/plugins/dlt_en10mb/en10mb.c
  83. 1 1
      src/tcpedit/plugins/dlt_hdlc/hdlc.c
  84. 1 1
      src/tcpedit/plugins/dlt_ieee80211/ieee80211.c
  85. 5 3
      src/tcpedit/plugins/dlt_ieee80211/ieee80211.h
  86. 1 1
      src/tcpedit/plugins/dlt_linuxsll/linuxsll.c
  87. 5 4
      src/tcpedit/plugins/dlt_linuxsll/linuxsll.h
  88. 1 1
      src/tcpedit/plugins/dlt_null/null.c
  89. 5 3
      src/tcpedit/plugins/dlt_null/null.h
  90. 3 1
      src/tcpedit/plugins/dlt_plugins.c
  91. 3 2
      src/tcpedit/plugins/dlt_radiotap/radiotap.h
  92. 1 1
      src/tcpedit/plugins/dlt_raw/raw.c
  93. 5 3
      src/tcpedit/plugins/dlt_raw/raw.h
  94. 3 2
      src/tcpedit/plugins/dlt_user/user.h
  95. 10 3
      src/tcpedit/tcpedit-int.h
  96. 8 3
      src/tcpedit/tcpedit.c
  97. 17 0
      src/tcpedit/tcpedit_opts.def
  98. 29 27
      src/tcpedit/tcpedit_stub.h
  99. 14 4
      src/tcpprep.1
  100. 0 0
      src/tcpprep.c

+ 33 - 21
Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -85,6 +85,7 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CUT = @CUT@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -92,6 +93,8 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DMALLOC_LIB = @DMALLOC_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -107,6 +110,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LDFLAGS = @LDFLAGS@
+LDNETINC = @LDNETINC@
+LDNETLIB = @LDNETLIB@
 LIBOBJS = @LIBOBJS@
 LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
 LIBOPTS_DIR = @LIBOPTS_DIR@
@@ -124,6 +129,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -200,6 +206,7 @@ target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
 tcpdump_path = @tcpdump_path@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
@@ -339,8 +346,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -365,8 +372,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { 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) \
@@ -376,13 +383,12 @@ ctags: CTAGS
 CTAGS: ctags-recursive $(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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique
@@ -456,6 +462,10 @@ dist-bzip2: distdir
 	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
 	$(am__remove_distdir)
 
+dist-lzma: distdir
+	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+	$(am__remove_distdir)
+
 dist-tarZ: distdir
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 	$(am__remove_distdir)
@@ -482,6 +492,8 @@ distcheck: dist
 	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.lzma*) \
+	  unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
@@ -636,18 +648,18 @@ uninstall-am:
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
 	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
-	dist-gzip dist-hook dist-shar dist-tarZ dist-zip distcheck \
-	distclean distclean-generic distclean-libtool distclean-local \
-	distclean-tags distcleancheck distdir distuninstallcheck 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 installdirs-am \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am
+	dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-zip \
+	distcheck distclean distclean-generic distclean-libtool \
+	distclean-local distclean-tags distcleancheck distdir \
+	distuninstallcheck 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 \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags tags-recursive uninstall uninstall-am
 
 .PHONY: manpages docs test man2html
 

+ 200 - 107
aclocal.m4

@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This file 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.
@@ -11,14 +11,17 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-m4_if(m4_PACKAGE_VERSION, [2.61],,
-[m4_fatal([this file was generated for autoconf 2.61.
-You have another version of autoconf.  If you want to use that,
-you should regenerate the build system entirely.], [63])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(AC_AUTOCONF_VERSION, [2.62],,
+[m4_warning([this file was generated for autoconf 2.62.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 
-# serial 51 AC_PROG_LIBTOOL
+# serial 52 AC_PROG_LIBTOOL
 
 
 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
@@ -106,7 +109,6 @@ AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
 AC_REQUIRE([AC_OBJEXT])dnl
 AC_REQUIRE([AC_EXEEXT])dnl
 dnl
-
 AC_LIBTOOL_SYS_MAX_CMD_LEN
 AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
 AC_LIBTOOL_OBJDIR
@@ -208,6 +210,8 @@ file_magic*)
   ;;
 esac
 
+_LT_REQUIRED_DARWIN_CHECKS
+
 AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
 AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
 enable_win32_dll=yes, enable_win32_dll=no)
@@ -287,9 +291,80 @@ ac_outfile=conftest.$ac_objext
 echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
-$rm conftest*
+$rm -r conftest*
 ])# _LT_LINKER_BOILERPLATE
 
+# _LT_REQUIRED_DARWIN_CHECKS
+# --------------------------
+# Check for some things on darwin
+AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+   # By default we will add the -single_module flag. You can override
+   # by either setting the environment variable LT_MULTI_MODULE
+   # non-empty at configure time, or by adding -multi_module to the
+   # link flags.
+   echo "int foo(void){return 1;}" > conftest.c
+   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+     -dynamiclib ${wl}-single_module conftest.c
+   if test -f libconftest.dylib; then
+     lt_cv_apple_cc_single_mod=yes
+     rm -rf libconftest.dylib*
+   fi
+   rm conftest.c
+      fi])
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+   [lt_cv_ld_exported_symbols_list=yes],
+   [lt_cv_ld_exported_symbols_list=no])
+   LDFLAGS="$save_LDFLAGS"
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[0123]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*)
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+   10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+   10.[[012]]*)
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+   10.*)
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
+    fi
+    if test "$DSYMUTIL" != ":"; then
+      _lt_dsymutil="~$DSYMUTIL \$lib || :"
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
 
 # _LT_AC_SYS_LIBPATH_AIX
 # ----------------------
@@ -614,7 +689,11 @@ sparc*-*solaris*)
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
       yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)    LD="${LD-ld} -64" ;;
+      *)
+        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
       esac
       ;;
     esac
@@ -707,7 +786,7 @@ AC_CACHE_CHECK([$1], [$2],
        $2=yes
      fi
    fi
-   $rm conftest*
+   $rm -r conftest*
    LDFLAGS="$save_LDFLAGS"
 ])
 
@@ -978,7 +1057,7 @@ else
     AC_CHECK_FUNC([shl_load],
 	  [lt_cv_dlopen="shl_load"],
       [AC_CHECK_LIB([dld], [shl_load],
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
 	[AC_CHECK_FUNC([dlopen],
 	      [lt_cv_dlopen="dlopen"],
 	  [AC_CHECK_LIB([dl], [dlopen],
@@ -986,7 +1065,7 @@ else
 	    [AC_CHECK_LIB([svld], [dlopen],
 		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
 	      [AC_CHECK_LIB([dld], [dld_link],
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
 	      ])
 	    ])
 	  ])
@@ -1303,7 +1382,7 @@ aix3*)
   soname_spec='${libname}${release}${shared_ext}$major'
   ;;
 
-aix4* | aix5*)
+aix[[4-9]]*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -1824,6 +1903,13 @@ esac
 AC_MSG_RESULT([$dynamic_linker])
 test "$dynamic_linker" = no && can_build_shared=no
 
+AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
+[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
+[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
@@ -2323,7 +2409,7 @@ lt_cv_deplibs_check_method='unknown'
 # whether `pass_all' will *always* work, you probably want this one.
 
 case $host_os in
-aix4* | aix5*)
+aix[[4-9]]*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -2759,7 +2845,7 @@ aix3*)
   fi
   ;;
 
-aix4* | aix5*)
+aix[[4-9]]*)
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
     test "$enable_shared" = yes && enable_static=no
   fi
@@ -2816,6 +2902,7 @@ _LT_AC_TAGVAR(postdep_objects, $1)=
 _LT_AC_TAGVAR(predeps, $1)=
 _LT_AC_TAGVAR(postdeps, $1)=
 _LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
 
 # Source file extension for C++ test sources.
 ac_ext=cpp
@@ -2925,7 +3012,7 @@ case $host_os in
     # FIXME: insert proper C++ library support
     _LT_AC_TAGVAR(ld_shlibs, $1)=no
     ;;
-  aix4* | aix5*)
+  aix[[4-9]]*)
     if test "$host_cpu" = ia64; then
       # On IA64, the linker does run time linking by default, so we don't
       # have to do anything special.
@@ -2938,7 +3025,7 @@ case $host_os in
       # Test if we are trying to use run time linking or normal
       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
       # need to do runtime linking.
-      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
 	for ld_flag in $LDFLAGS; do
 	  case $ld_flag in
 	  *-brtl*)
@@ -3084,51 +3171,23 @@ case $host_os in
     fi
   ;;
       darwin* | rhapsody*)
-        case $host_os in
-        rhapsody* | darwin1.[[012]])
-         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
-         ;;
-       *) # Darwin 1.3 on
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-         else
-           case ${MACOSX_DEPLOYMENT_TARGET} in
-             10.[[012]])
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-               ;;
-             10.*)
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
-               ;;
-           esac
-         fi
-         ;;
-        esac
       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_AC_TAGVAR(hardcode_direct, $1)=no
       _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
-    if test "$GXX" = yes ; then
-      lt_int_apple_cc_single_mod=no
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+      if test "$GXX" = yes ; then
       output_verbose_link_cmd='echo'
-      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
-       lt_int_apple_cc_single_mod=yes
+      _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+      _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
       fi
-      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-      else
-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-        fi
-        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          else
-            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          fi
-            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
       else
       case $cc_basename in
         xlc*)
@@ -3379,7 +3438,7 @@ case $host_os in
 	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
 	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
 	;;
-      pgCC*)
+      pgCC* | pgcpp*)
         # Portland Group C++ compiler
 	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
   	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
@@ -3814,7 +3873,8 @@ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
 # compiler output when linking a shared library.
 # Parse the compiler output and extract the necessary
 # objects, libraries and library flags.
-AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
 dnl we can't use the lt_simple_compile_test_code here,
 dnl because it contains code intended for an executable,
 dnl not a library.  It's possible we should let each
@@ -3939,6 +3999,11 @@ fi
 
 $rm -f confest.$objext
 
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+  _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
 # PORTME: override above test on systems where it is broken
 ifelse([$1],[CXX],
 [case $host_os in
@@ -3995,7 +4060,6 @@ solaris*)
   ;;
 esac
 ])
-
 case " $_LT_AC_TAGVAR(postdeps, $1) " in
 *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
 esac
@@ -4080,7 +4144,7 @@ aix3*)
     postinstall_cmds='$RANLIB $lib'
   fi
   ;;
-aix4* | aix5*)
+aix[[4-9]]*)
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
     test "$enable_shared" = yes && enable_static=no
   fi
@@ -4257,6 +4321,7 @@ if test -f "$ltmain"; then
     _LT_AC_TAGVAR(predeps, $1) \
     _LT_AC_TAGVAR(postdeps, $1) \
     _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \
     _LT_AC_TAGVAR(archive_cmds, $1) \
     _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
     _LT_AC_TAGVAR(postinstall_cmds, $1) \
@@ -4319,7 +4384,7 @@ ifelse([$1], [],
 # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 # Free Software Foundation, Inc.
 #
 # This file is part of GNU Libtool:
@@ -4556,6 +4621,10 @@ predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
 # shared library.
 postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
 
+# The directories searched by this compiler when creating a shared
+# library
+compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)
+
 # The library search path used internally by the compiler when linking
 # a shared library.
 compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
@@ -4905,7 +4974,7 @@ EOF
     echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
     cat conftest.$ac_ext >&5
   fi
-  rm -f conftest* conftst*
+  rm -rf conftest* conftst*
 
   # Do not use the global_symbol_pipe unless it works.
   if test "$pipe_works" = yes; then
@@ -4962,7 +5031,8 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
       # (--disable-auto-import) libraries
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      m4_if([$1], [GCJ], [],
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
       ;;
     darwin* | rhapsody*)
       # PIC is the default on this platform
@@ -4999,7 +5069,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
     esac
   else
     case $host_os in
-      aix4* | aix5*)
+      aix[[4-9]]*)
 	# All AIX code is PIC.
 	if test "$host_cpu" = ia64; then
 	  # AIX 5 now supports IA64 processor
@@ -5095,7 +5165,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
 	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
 	    ;;
-	  pgCC*)
+	  pgCC* | pgcpp*)
 	    # Portland Group C++ compiler.
 	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
@@ -5246,7 +5316,8 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
       # (--disable-auto-import) libraries
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      m4_if([$1], [GCJ], [],
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
       ;;
 
     darwin* | rhapsody*)
@@ -5316,7 +5387,8 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
     mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      m4_if([$1], [GCJ], [],
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
       ;;
 
     hpux9* | hpux10* | hpux11*)
@@ -5453,7 +5525,7 @@ AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
 #
 if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
   AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
-    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1),
     [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
     [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
      "" | " "*) ;;
@@ -5477,7 +5549,7 @@ esac
 #
 wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
 AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
-  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+  _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
   $lt_tmp_static_flag,
   [],
   [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
@@ -5493,7 +5565,7 @@ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
 ifelse([$1],[CXX],[
   _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   case $host_os in
-  aix4* | aix5*)
+  aix[[4-9]]*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
     if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
@@ -5512,6 +5584,7 @@ ifelse([$1],[CXX],[
     _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   ;;
   esac
+  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
 ],[
   runpath_var=
   _LT_AC_TAGVAR(allow_undefined_flag, $1)=
@@ -5542,12 +5615,14 @@ ifelse([$1],[CXX],[
   # it will be wrapped by ` (' and `)$', so one must not match beginning or
   # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
   # as well as any symbol that contains `d'.
-  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
   # the symbol is explicitly referenced.  Since portable code cannot
   # rely on this symbol name, it's probably fine to never include it in
   # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
   extract_expsyms_cmds=
   # Just being paranoid about ensuring that cc_basename is set.
   _LT_CC_BASENAME([$compiler])
@@ -5597,7 +5672,7 @@ ifelse([$1],[CXX],[
 
     # See if GNU ld supports shared libraries.
     case $host_os in
-    aix3* | aix4* | aix5*)
+    aix[[3-9]]*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
 	_LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -5816,7 +5891,7 @@ _LT_EOF
       fi
       ;;
 
-    aix4* | aix5*)
+    aix[[4-9]]*)
       if test "$host_cpu" = ia64; then
 	# On IA64, the linker does run time linking by default, so we don't
 	# have to do anything special.
@@ -5836,7 +5911,7 @@ _LT_EOF
 	# Test if we are trying to use run time linking or normal
 	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
 	# need to do runtime linking.
-	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
 	  for ld_flag in $LDFLAGS; do
   	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
   	    aix_use_runtimelinking=yes
@@ -5969,25 +6044,7 @@ _LT_EOF
       ;;
 
     darwin* | rhapsody*)
-      case $host_os in
-        rhapsody* | darwin1.[[012]])
-         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
-         ;;
-       *) # Darwin 1.3 on
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-         else
-           case ${MACOSX_DEPLOYMENT_TARGET} in
-             10.[[012]])
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-               ;;
-             10.*)
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
-               ;;
-           esac
-         fi
-         ;;
-      esac
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_AC_TAGVAR(hardcode_direct, $1)=no
       _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
@@ -5996,11 +6053,10 @@ _LT_EOF
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
     if test "$GCC" = yes ; then
     	output_verbose_link_cmd='echo'
-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+        _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+        _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
     else
       case $cc_basename in
         xlc*)
@@ -6581,7 +6637,7 @@ AC_SUBST([SED])
 AC_MSG_RESULT([$SED])
 ])
 
-# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -6596,7 +6652,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.10'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.10], [],
+m4_if([$1], [1.10.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -6612,8 +6668,10 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10])dnl
-_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
@@ -6885,7 +6943,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
   # each Makefile.in and add a new line on top of each file to say so.
   # Grep'ing the whole file is not good either: AIX grep has a line
   # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
     dirpart=`AS_DIRNAME("$mf")`
   else
     continue
@@ -6973,13 +7031,13 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006 Free Software Foundation, Inc.
+# 2005, 2006, 2008 Free Software Foundation, Inc.
 #
 # This file 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.
 
-# serial 12
+# serial 13
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -7084,16 +7142,17 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC],
 # our stamp files there.
 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
 [# Compute $1's index in $config_headers.
+_am_arg=$1
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
-    $1 | $1:* )
+    $_am_arg | $_am_arg:* )
       break ;;
     * )
       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
   esac
 done
-echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
 # Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
@@ -7211,6 +7270,40 @@ AC_MSG_RESULT([$_am_result])
 rm -f confinc confmf
 ])
 
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file 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.
+
+# serial 5
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
@@ -7394,7 +7487,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
-# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
 # This macro is traced by Automake.
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 

File diff suppressed because it is too large
+ 7039 - 5929
configure


+ 109 - 28
configure.ac

@@ -1,5 +1,5 @@
 
-dnl $Id: configure.ac 1954 2008-01-17 06:10:31Z aturner $
+dnl $Id: configure.ac 2029 2008-05-17 17:45:36Z aturner $
 
 AC_INIT(tcpreplay)
 AC_CONFIG_SRCDIR(src/tcpreplay.c)
@@ -8,10 +8,14 @@ AC_CONFIG_AUX_DIR(config)
 AM_MAINTAINER_MODE
 AM_WITH_DMALLOC
 
+dnl People building from SVN need the same version of Autogen as I'm using
+dnl or specify --disable-local-libopts
+MAINTAINER_AUTOGEN_VERSION=5.9.2
+
 dnl Set version info here!
 MAJOR_VERSION=3
-MINOR_VERSION=2
-MICRO_VERSION=4
+MINOR_VERSION=3
+MICRO_VERSION=1
 TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
 
 dnl Release is only used for the RPM spec file
@@ -47,7 +51,7 @@ AM_INIT_AUTOMAKE(tcpreplay, $TCPREPLAY_VERSION, nodefine)
 dnl Checks for programs.
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
-AC_PROG_CC
+AM_PROG_CC_C_O
 AC_PROG_CC_STDC
 AC_PROG_CXX
 AC_PROG_CPP
@@ -58,23 +62,43 @@ AC_PROG_SED
 AC_PROG_MAKE_SET
 AC_EXEEXT
 AC_PATH_PROG(PRINTF, printf)
-AC_PATH_PROG(AUTOGEN, autogen)
 AC_PATH_PROG(ECHO, echo)
+AC_PATH_PROG(CUT, cut)
+AC_PATH_PROG(AUTOGEN, autogen)
 
 dnl check autogen version
+AUTOGEN_VERSION=unknown
 if test -n "${AUTOGEN}" ; then
-	AC_MSG_CHECKING(for autogen version >= 5.9)
-	AUTOGEN_VERSION=`${AUTOGEN} -v | ${SED} 's|.*\([[0-9\.]]\{3,\}\)$|\1|'`
-	AUTOGEN_MAJOR=`echo ${AUTOGEN_VERSION} | ${SED} 's|^\([[0-9]]\)\.[[0-9]]|\1|'`
-	AUTOGEN_MINOR=`echo ${AUTOGEN_VERSION} | ${SED} 's|^\([[0-9]]\)\.\([[0-9]]\)|\2|'`
-	if test ${AUTOGEN_MAJOR} -le 5 && test ${AUTOGEN_MINOR} -lt 9 || test ${AUTOGEN_MAJOR} -lt 5 ; then
+	AC_MSG_CHECKING(for autogen version >= 5.9.x)
+	${AUTOGEN} -v >autogen.version
+	AUTOGEN_VERSION=`cat autogen.version | ${SED} 's|.*\([[0-9\.]]\{5,\}\).*|\1|'`
+	AUTOGEN_MAJOR=`echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 1`
+	AUTOGEN_MINOR=`echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 2`
+	if ( test ${AUTOGEN_MAJOR} -eq 5 && test ${AUTOGEN_MINOR} -lt 9 ) || test ${AUTOGEN_MAJOR} -lt 5 ; then
 		AC_MSG_RESULT(no)
-		AC_MSG_WARN([${AUTOGEN} is too old (${AUTOGEN_VERSION}) for building from SVN.  Please upgrade to 5.9)])
+		AC_MSG_WARN([${AUTOGEN} is too old (${AUTOGEN_VERSION}) for building from SVN.  Please upgrade to 5.9.x)])
 	else
 		AC_MSG_RESULT(yes)
 	fi
+	rm -f autogen.version
+	
+	dnl Compare the installed version with the maintainer version if building from SVN and not using system libopts
+    if test ! -f src/tcpreplay_opts.c && test $enable_local_libopts == yes ; then
+        if test $MAINTAINER_AUTOGEN_VERSION != $AUTOGEN_VERSION ; then
+            AC_MSG_ERROR([Your version of autogen ($AUTOGEN_VERSION) != libopts tear off ($MAINTAINER_AUTOGEN_VERSION)  Either install the correct version or specify --disable-local-libopts])
+        fi
+    fi
+else
+    if test ! -f src/tcpreplay_opts.c ; then
+    	AC_MSG_ERROR([Please install GNU autogen >= 5.9.x if you are building from SVN])
+    fi
+fi
+AC_DEFINE([AUTOGEN_VERSION], [${AUTOGEN_VERSION}], [What version of autogen is installed on this system])
+
+if test $enable_local_libopts == yes ; then
+    AC_MSG_NOTICE([Using included libopts tearoff])
 else
-	AC_MSG_WARN([Please install autogen >= 5.9 if you are building from SVN])
+    AC_MSG_NOTICE([Using system libopts])
 fi
 
 AC_HEADER_STDC
@@ -132,7 +156,7 @@ CFLAGS="$OLD_CFLAGS $wfatal_errors"
 
 
 dnl Check for other header files
-AC_CHECK_HEADERS([fcntl.h stddef.h sys/socket.h  arpa/inet.h sys/time.h signal.h string.h strings.h sys/types.h sys/select.h netinet/in.h poll.h sys/poll.h unistd.h sys/param.h])
+AC_CHECK_HEADERS([fcntl.h stddef.h sys/socket.h  arpa/inet.h sys/time.h signal.h string.h strings.h sys/types.h stdint.h sys/select.h netinet/in.h poll.h sys/poll.h unistd.h sys/param.h])
 
 dnl OpenBSD has special requirements
 AC_CHECK_HEADERS([sys/sysctl.h net/route.h], [], [], [
@@ -185,6 +209,18 @@ AC_ARG_ENABLE(debug,
       fi])
 
 
+AC_ARG_ENABLE(dmalloc,
+    AC_HELP_STRING([--enable-dmalloc], [Enable linking to dmalloc for better memory debugging]),
+    [ if test x$enableval = xyes ; then
+        dmalloc=yes
+        AC_DEFINE([ENABLE_DMALLOC], [1], [Enable dmalloc])
+        AC_DEFINE([DMALLOC_FUNC_CHECK], [1], [Enable dmalloc function arg checking])
+        CFLAGS="${CFLAGS} -I/opt/local/include"
+        DMALLOC_LIB="/opt/local/lib/libdmalloc.a"
+        AC_SUBST(DMALLOC_LIB)
+    fi])
+
+
 AC_ARG_ENABLE(pedantic,
     AC_HELP_STRING([--enable-pedantic], [Enable gcc's -pedantic option]),
     [ if test x$enableval = xyes; then
@@ -453,7 +489,7 @@ AC_ARG_WITH(libpcap,
     AC_HELP_STRING([--with-libpcap=DIR], [Use libpcap in DIR]),
     [trypcapdir=$withval])
 
-	for testdir in $trypcapdir /usr/local /opt/local /usr ; do 
+	for testdir in $trypcapdir /usr/local /opt/local /usr /wpdpack ; do 
     	if test -f "${testdir}/include/pcap.h" -a $foundpcap = no ; then
         	LPCAPINC="${testdir}/include/pcap.h"
 	        LPCAPINCDIR="${testdir}/include"
@@ -729,12 +765,12 @@ AC_MSG_CHECKING(for BPF device sending support)
 AC_TRY_RUN([
 #include <stdio.h>
 #include <stdlib.h>
-#include <net/bpf.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <fcntl.h>
 #include <sys/time.h>
 #include <sys/ioctl.h>
+#include <stdint.h>
 #include <net/bpf.h>
 #include <errno.h>
 
@@ -810,6 +846,7 @@ PCAP_BPF_H_FILE="$LPCAPINCDIR/pcap-bpf.h"
 AC_MSG_CHECKING(for $PCAP_BPF_H_FILE)
 AC_TRY_COMPILE([#include <sys/types.h>
                 #include <sys/time.h>
+                #include <stdint.h>
                 #include "$PCAP_BPF_H_FILE"],
                [ int foo;
                  foo = BPF_MAJOR_VERSION; ],
@@ -829,6 +866,7 @@ AC_MSG_CHECKING(for libpcap bpf header)
 			AC_TRY_COMPILE([
 				#include <sys/types.h>
 				#include <sys/time.h>
+				#include <stdint.h>
 				#include "$testfile"],
 			[
 				int foo;
@@ -850,6 +888,42 @@ dnl restore LIBS & CFLAGS
 LIBS="$OLDLIBS"
 CFLAGS="$OLDCFLAGS"
 
+dnl ##################################################
+dnl # Check for libdnet
+dnl ##################################################
+founddnet=no
+enable_fragroute=no
+trydnetdir=/usr/local
+AC_MSG_CHECKING(for libdnet)
+AC_ARG_WITH(libdnet,
+    AC_HELP_STRING([--with-libdnet=DIR], [Use libdnet in DIR]),
+    [trydnetdir=$withval])
+ 
+	for testdir in $trydnetdir /usr/local /opt/local /usr ; do 
+    	if test -x ${testdir}/bin/dnet-config -a $founddnet = no ; then
+            LDNETINC="`$testdir/bin/dnet-config --cflags`"
+            LDNETLIB="`$testdir/bin/dnet-config --libs`"
+
+        	founddnet=$testdir
+     	fi
+	done
+
+	if test $founddnet = no ; then
+		AC_MSG_RESULT(no)
+		AC_MSG_WARN([libdnet not found, disabling fragroute feature])
+	else
+		AC_MSG_RESULT($founddnet)
+		enable_fragroute=yes
+	    AC_DEFINE([HAVE_LIBDNET], [1], [Do we have libdnet?])
+	fi
+
+AC_SUBST(LDNETINC)
+AC_SUBST(LDNETLIB)
+AM_CONDITIONAL(COMPILE_FRAGROUTE, [test x$founddnet != xno])
+if test x$founddnet != xno ; then
+    AC_DEFINE(ENABLE_FRAGROUTE, [1], [Enable fragroute module])
+fi
+
 
 dnl ##################################################
 dnl # Check for pcapnav
@@ -924,12 +998,12 @@ dnl
 dnl     FORCE_ALIGN (DEFINED)
 dnl
 AC_MSG_CHECKING(for requires strict byte alignment)
-AC_CACHE_VAL(unaligned_fail,
+AC_CACHE_VAL(unaligned_cv_fail,
         [case "$host_cpu" in
 
         # XXX: should also check that they don't do weird things (like on arm)
         alpha*|arm*|hp*|mips*|sparc*|ia64)
-                unaligned_fail=yes
+                unaligned_cv_fail=yes
                 ;;
 
         *)
@@ -963,21 +1037,21 @@ EOF
                     conftest.c $LIBS >/dev/null 2>&1
                 if test ! -x conftest ; then
                         dnl failed to compile for some reason
-                        unaligned_fail=yes
+                        unaligned_cv_fail=yes
                 else
                         ./conftest >conftest.out
                         if test ! -s conftest.out ; then
-                                unaligned_fail=yes
+                                unaligned_cv_fail=yes
                         else
-                                unaligned_fail=no
+                                unaligned_cv_fail=no
                         fi
                 fi
                 rm -f conftest* core core.conftest
                 ;;
         esac])
-    AC_MSG_RESULT($unaligned_fail)
-    if test $unaligned_fail = yes ; then
-            AC_DEFINE([FORCE_ALIGN],[1],[Are we strictly aligned?])
+    AC_MSG_RESULT($unaligned_cv_fail)
+    if test $unaligned_cv_fail = yes ; then
+            AC_DEFINE([FORCE_ALIGN], [1], [Are we strictly aligned?])
     fi
 
 dnl ##################################################
@@ -1031,7 +1105,7 @@ dnl There's a bug in OS X which causes pcap_findalldevs() to make the wifi NIC t
 dnl so under OSX we disable the interface list feature
 disable_pcap_findalldevs=no
 
-
+osx_frameworks=no
 dnl these need to be dynamic based on OS
 case $host in
 	*-*-linux*)
@@ -1058,6 +1132,8 @@ case $host in
 	if test x$libpcap_version_096 = xno ; then
     	disable_pcap_findalldevs=yes
     fi
+    AC_DEFINE([HAVE_ABSOLUTE_TIME], [1], [Have OS X UpTime()/AbsoluteTime high-precision timing])
+    osx_frameworks=yes
 	AC_MSG_RESULT(Apple OS X)
 	;;
 
@@ -1080,6 +1156,7 @@ case $host in
 	;;
 esac])
 
+AM_CONDITIONAL([ENABLE_OSX_FRAMEWORKS], test "$osx_frameworks" == "yes")
 
 AC_ARG_WITH(testnic2,
     AC_HELP_STRING([--with-testnic2=NIC2], [Select an optional 2nd network card to use for testing]),
@@ -1124,6 +1201,7 @@ AC_OUTPUT([Makefile
            src/Makefile
            src/common/Makefile
            src/tcpedit/Makefile
+           src/fragroute/Makefile
            src/defines.h
            test/Makefile
            test/config
@@ -1137,11 +1215,14 @@ AC_MSG_RESULT(
 ##########################################################################
 libpcap:                    ${foundpcap} (${libpcap_version})
 libnet:                     ${foundnet}
-autogen:                    ${AUTOGEN}
+libdnet:                    ${founddnet}
+autogen:                    ${AUTOGEN} (${AUTOGEN_VERSION})
+Use libopts tearoff:        ${enable_local_libopts}
 64bit counter support:      ${use64bit_counters}
 tcpdump binary path:        ${tcpdump_path}
 tcpreplay edit support:     ${tcpreplay_edit}
 tcpbridge support:          ${enable_tcpbridge}
+fragroute support:          ${enable_fragroute}
 
 Supported Packet Injection Methods (*):
 Linux PF_PACKET:            ${have_pf}
@@ -1157,12 +1238,12 @@ pcap_sendpacket:            ${have_pcap_sendpacket}
 case $host in
 	*-apple-darwin*)
 	AC_MSG_WARN([Apple OS X versions prior to 10.5 (Leopard) has a serious problem!
-	Please see: http://tcpreplay.synfin.net/trac/ticket/142 for more details])
+Please see: http://tcpreplay.synfin.net/trac/ticket/142 for more details])
 	;;
 	
 	*-*-cygwin)
-	AC_MSG_WARN([Windows/Cygwin support is still somewhat experimental.  Please report any bugs!
-	http://tcpreplay.synfin.net/trac/newticket])
+	AC_MSG_WARN([Windows/Cygwin support is still somewhat experimental. 
+Please report any bugs!	http://tcpreplay.synfin.net/trac/newticket])
 	;;
 esac
 

+ 30 - 2
docs/CHANGELOG

@@ -1,4 +1,32 @@
-$Id: CHANGELOG 1957 2008-01-17 06:24:18Z aturner $
+$Id: CHANGELOG 2032 2008-05-17 18:25:39Z aturner $
+
+05/17/2008: Version 3.3.1
+    - Fix limitation of PF_PACKET only supporting Ethernet (#123)
+    - Fix (again) /dev/bpf detection in FreeBSD 8.0 (#292)
+    - Document building code from Subversion under Cygwin (#304)
+    - Fix --enable-force-* under Linux (#305)
+    - Fix tcpbridge --unidir assert error (#308)
+
+05/04/2008: Version 3.3.0
+    - Improve tcpreplay timing accuracy between packets (#41)
+    - Add tcprewrite fragroute support (#42)
+    - Fix tcprewrite --efcs option (#277)
+    - Updated Win32/Cygwin documentation (#280)
+    - Add dmalloc support (#282)
+    - Fix tcpprep broken handling of VLAN tagged frames (#290)
+    - Fix tcprewrite crash when cache file has NO_SEND packets (#291)
+    - Fix /dev/bpf detection in FreeBSD 8.0 (#292)
+    - Add tcprewrite --ttl editing option (#294)
+    - Fix autoconf AM_PROG_CC_C_O warning (#295)
+    - Add tcpprep --reverse option to split by matching client addresses (#297)
+    - Update version of autoconf to 1.10.1 (#298)
+    - Improved GNU Autogen detection and warnings (#299)
+    - Track EAGAIN errors separately from ENOBUFS (#301)
+    - Automatically detect Winpcap on Cygwin (#303)
+
+01/23/2008: Version 3.2.5
+    - Fix linker error with --enable-tcpreplay-edit and --enable-dynamic-link (#288)
+    - Fix compile errors with Sun Studio compiler (#286)
 
 01/16/2008: Version 3.2.4
     - Fix crash in tcpreplay when --enable-tcpreplay-edit (#281)
@@ -20,7 +48,7 @@ $Id: CHANGELOG 1957 2008-01-17 06:24:18Z aturner $
     - 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)
     - Add Tomahawk test tool client/server detection algorithm (#186)

+ 2 - 2
docs/LICENSE

@@ -1,5 +1,5 @@
-$Id: LICENSE 1762 2007-03-24 20:42:05Z aturner $
-Copyright (c) 2001-2007 Aaron Turner.  aturner at synfin dot net
+$Id: LICENSE 1997 2008-04-27 05:35:10Z aturner $
+Copyright (c) 2001-2008 Aaron Turner.  aturner at synfin dot net
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without

+ 9 - 2
docs/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -57,6 +57,7 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CUT = @CUT@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -64,6 +65,8 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DMALLOC_LIB = @DMALLOC_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -79,6 +82,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LDFLAGS = @LDFLAGS@
+LDNETINC = @LDNETINC@
+LDNETLIB = @LDNETLIB@
 LIBOBJS = @LIBOBJS@
 LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
 LIBOPTS_DIR = @LIBOPTS_DIR@
@@ -96,6 +101,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -172,6 +178,7 @@ target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
 tcpdump_path = @tcpdump_path@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 MAKEFLAGS = -s

+ 16 - 10
lib/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -50,7 +50,7 @@ libstrl_a_AR = $(AR) $(ARFLAGS)
 libstrl_a_LIBADD =
 am_libstrl_a_OBJECTS = strlcat.$(OBJEXT) strlcpy.$(OBJEXT)
 libstrl_a_OBJECTS = $(am_libstrl_a_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -81,6 +81,7 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CUT = @CUT@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -88,6 +89,8 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DMALLOC_LIB = @DMALLOC_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -103,6 +106,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LDFLAGS = @LDFLAGS@
+LDNETINC = @LDNETINC@
+LDNETLIB = @LDNETLIB@
 LIBOBJS = @LIBOBJS@
 LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
 LIBOPTS_DIR = @LIBOPTS_DIR@
@@ -120,6 +125,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -196,6 +202,7 @@ target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
 tcpdump_path = @tcpdump_path@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 noinst_LIBRARIES = libstrl.a
@@ -285,8 +292,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -298,8 +305,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { 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) \
@@ -309,13 +316,12 @@ 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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

+ 20 - 14
libopts/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -59,7 +59,7 @@ libopts_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(libopts_la_LDFLAGS) $(LDFLAGS) -o $@
 @INSTALL_LIBOPTS_FALSE@am_libopts_la_rpath =
 @INSTALL_LIBOPTS_TRUE@am_libopts_la_rpath = -rpath $(libdir)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -89,6 +89,7 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CUT = @CUT@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -96,6 +97,8 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DMALLOC_LIB = @DMALLOC_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -111,6 +114,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LDFLAGS = @LDFLAGS@
+LDNETINC = @LDNETINC@
+LDNETLIB = @LDNETLIB@
 LIBOBJS = @LIBOBJS@
 LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
 LIBOPTS_DIR = @LIBOPTS_DIR@
@@ -128,6 +133,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -204,6 +210,7 @@ target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
 tcpdump_path = @tcpdump_path@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 MAINTAINERCLEANFILES = Makefile.in
@@ -267,8 +274,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	  if test -f $$p; then \
 	    f=$(am__strip_dir) \
-	    echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
-	    $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
 	  else :; fi; \
 	done
 
@@ -276,8 +283,8 @@ uninstall-libLTLIBRARIES:
 	@$(NORMAL_UNINSTALL)
 	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
 	  p=$(am__strip_dir) \
-	  echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
-	  $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
 	done
 
 clean-libLTLIBRARIES:
@@ -347,8 +354,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -360,8 +367,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { 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) \
@@ -371,13 +378,12 @@ 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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

+ 16 - 10
scripts/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -47,7 +47,7 @@ PROGRAMS = $(noinst_PROGRAMS)
 am_man2html_OBJECTS = man2html.$(OBJEXT)
 man2html_OBJECTS = $(am_man2html_OBJECTS)
 man2html_LDADD = $(LDADD)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -77,6 +77,7 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CUT = @CUT@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -84,6 +85,8 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DMALLOC_LIB = @DMALLOC_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -99,6 +102,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LDFLAGS = @LDFLAGS@
+LDNETINC = @LDNETINC@
+LDNETLIB = @LDNETLIB@
 LIBOBJS = @LIBOBJS@
 LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
 LIBOPTS_DIR = @LIBOPTS_DIR@
@@ -116,6 +121,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -192,6 +198,7 @@ target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
 tcpdump_path = @tcpdump_path@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 man2html_SOURCES = man2html.c
@@ -282,8 +289,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -295,8 +302,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { 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) \
@@ -306,13 +313,12 @@ 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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

BIN
src/._Makefile.am


BIN
src/._tcpreplay_opts.def


+ 30 - 12
src/Makefile.am

@@ -1,5 +1,13 @@
 # $Id: Makefile.am 1632 2007-02-03 18:46:16Z aturner $
-SUBDIRS = common tcpedit
+if COMPILE_FRAGROUTE
+    LIBFRAGROUTE = ./fragroute/libfragroute.a @LDNETLIB@
+    FRAGROUTE_DIR = fragroute
+else
+    LIBFRAGROUTE = 
+    FRAGROUTE_DIR = 
+endif
+ 
+SUBDIRS = common tcpedit $(FRAGROUTE_DIR)
 
 if SYSTEM_STRLCPY
 LIBSTRL =
@@ -41,14 +49,20 @@ EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 tcpreplay-edit.1
 bin_PROGRAMS = tcpreplay tcpprep tcprewrite tcpbridge
 
 tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPREPLAY
-tcpreplay_LDADD = ./common/libcommon.a $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
-tcpreplay_SOURCES = send_packets.c signal_handler.c tcpreplay.c
 
 if ENABLE_TCPREPLAY_EDIT
-tcpreplay_LDADD += ./tcpedit/libtcpedit.a
-tcpreplay_SOURCES += tcpreplay_edit_opts.c
+tcpreplay_LDADD = ./tcpedit/libtcpedit.a
+tcpreplay_SOURCES = tcpreplay_edit_opts.c
 else
-tcpreplay_SOURCES += tcpreplay_opts.c
+tcpreplay_SOURCES = tcpreplay_opts.c
+tcpreplay_LDADD = 
+endif
+
+tcpreplay_LDADD += ./common/libcommon.a $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
+tcpreplay_SOURCES += send_packets.c signal_handler.c tcpreplay.c sleep.c
+
+if ENABLE_OSX_FRAMEWORKS
+tcpreplay_LDFLAGS = -framework CoreServices -framework Carbon
 endif
 
 tcpreplay_OBJECTS: tcpreplay_opts.h
@@ -60,9 +74,10 @@ tcpreplay_edit_opts.c: tcpreplay_opts.def
 	@AUTOGEN@ $(opts_list) -DTCPREPLAY_EDIT -b tcpreplay_edit_opts \
 		tcpreplay_opts.def
 
-tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
+tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I.. @LDNETINC@ $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
 tcprewrite_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
-	$(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
+	$(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@ \
+	$(LIBFRAGROUTE)
 tcprewrite_SOURCES = tcprewrite_opts.c tcprewrite.c 
 tcprewrite_OBJECTS: tcprewrite_opts.h
 tcprewrite_opts.h: tcprewrite_opts.c
@@ -72,7 +87,7 @@ tcprewrite_opts.c: tcprewrite_opts.def tcpedit/tcpedit_opts.def
 
 tcpprep_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPPREP
 tcpprep_LDADD = ./common/libcommon.a \
-		  $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
+    $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
 tcpprep_SOURCES = tcpprep_opts.c tcpprep.c tree.c 
 tcpprep_OBJECTS: tcpprep_opts.h
 tcpprep_opts.h: tcpprep_opts.c
@@ -81,8 +96,11 @@ tcpprep_opts.c: tcpprep_opts.def
 
 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 		
+    $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
+if ENABLE_OSX_FRAMEWORKS
+tcpbridge_LDFLAGS = -framework CoreServices -framework Carbon
+endif
+tcpbridge_SOURCES = tcpbridge_opts.c tcpbridge.c bridge.c send_packets.c sleep.c
 tcpbridge_OBJECTS: tcpbridge_opts.h
 tcpbridge_opts.h: tcpbridge_opts.c
 tcpbridge_opts.c: tcpbridge_opts.def tcpedit/tcpedit_opts.def
@@ -92,7 +110,7 @@ noinst_HEADERS = tcpreplay.h tcpprep.h bridge.h defines.h tree.h \
 		 send_packets.h signal_handler.h common.h tcpreplay_opts.h \
 		 tcpreplay_edit_opts.h tcprewrite.h tcprewrite_opts.h tcpprep_opts.h \
 		 tcpprep_opts.def tcprewrite_opts.def tcpreplay_opts.def \
-		 tcpbridge_opts.def tcpbridge.h tcpbridge_opts.h tcpr.h
+		 tcpbridge_opts.def tcpbridge.h tcpbridge_opts.h tcpr.h sleep.h
 
 
 MOSTLYCLEANFILES = *~ *.o

+ 117 - 54
src/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -37,9 +37,6 @@ target_triplet = @target@
 @ENABLE_TCPREPLAY_EDIT_TRUE@am__append_1 = -DTCPREPLAY_EDIT
 bin_PROGRAMS = tcpreplay$(EXEEXT) tcpprep$(EXEEXT) tcprewrite$(EXEEXT) \
 	tcpbridge$(EXEEXT)
-@ENABLE_TCPREPLAY_EDIT_TRUE@am__append_2 = ./tcpedit/libtcpedit.a
-@ENABLE_TCPREPLAY_EDIT_TRUE@am__append_3 = tcpreplay_edit_opts.c
-@ENABLE_TCPREPLAY_EDIT_FALSE@am__append_4 = tcpreplay_opts.c
 subdir = src
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
@@ -56,7 +53,7 @@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
 am_tcpbridge_OBJECTS = tcpbridge-tcpbridge_opts.$(OBJEXT) \
 	tcpbridge-tcpbridge.$(OBJEXT) tcpbridge-bridge.$(OBJEXT) \
-	tcpbridge-send_packets.$(OBJEXT)
+	tcpbridge-send_packets.$(OBJEXT) tcpbridge-sleep.$(OBJEXT)
 tcpbridge_OBJECTS = $(am_tcpbridge_OBJECTS)
 @SYSTEM_STRLCPY_FALSE@am__DEPENDENCIES_1 = ../lib/libstrl.a
 am__DEPENDENCIES_2 =
@@ -64,7 +61,7 @@ tcpbridge_DEPENDENCIES = ./tcpedit/libtcpedit.a ./common/libcommon.a \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
 tcpbridge_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(tcpbridge_CFLAGS) \
-	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+	$(CFLAGS) $(tcpbridge_LDFLAGS) $(LDFLAGS) -o $@
 am_tcpprep_OBJECTS = tcpprep-tcpprep_opts.$(OBJEXT) \
 	tcpprep-tcpprep.$(OBJEXT) tcpprep-tree.$(OBJEXT)
 tcpprep_OBJECTS = $(am_tcpprep_OBJECTS)
@@ -73,25 +70,39 @@ tcpprep_DEPENDENCIES = ./common/libcommon.a $(am__DEPENDENCIES_1) \
 tcpprep_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(tcpprep_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-am__tcpreplay_SOURCES_DIST = send_packets.c signal_handler.c \
-	tcpreplay.c tcpreplay_edit_opts.c tcpreplay_opts.c
-@ENABLE_TCPREPLAY_EDIT_TRUE@am__objects_1 = tcpreplay-tcpreplay_edit_opts.$(OBJEXT)
-@ENABLE_TCPREPLAY_EDIT_FALSE@am__objects_2 = tcpreplay-tcpreplay_opts.$(OBJEXT)
-am_tcpreplay_OBJECTS = tcpreplay-send_packets.$(OBJEXT) \
-	tcpreplay-signal_handler.$(OBJEXT) \
-	tcpreplay-tcpreplay.$(OBJEXT) $(am__objects_1) \
-	$(am__objects_2)
+am__tcpreplay_SOURCES_DIST = tcpreplay_opts.c send_packets.c \
+	signal_handler.c tcpreplay.c sleep.c tcpreplay_edit_opts.c
+@ENABLE_TCPREPLAY_EDIT_FALSE@am_tcpreplay_OBJECTS = tcpreplay-tcpreplay_opts.$(OBJEXT) \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	tcpreplay-send_packets.$(OBJEXT) \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	tcpreplay-signal_handler.$(OBJEXT) \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	tcpreplay-tcpreplay.$(OBJEXT) \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	tcpreplay-sleep.$(OBJEXT)
+@ENABLE_TCPREPLAY_EDIT_TRUE@am_tcpreplay_OBJECTS = tcpreplay-tcpreplay_edit_opts.$(OBJEXT) \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	tcpreplay-send_packets.$(OBJEXT) \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	tcpreplay-signal_handler.$(OBJEXT) \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	tcpreplay-tcpreplay.$(OBJEXT) \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	tcpreplay-sleep.$(OBJEXT)
 tcpreplay_OBJECTS = $(am_tcpreplay_OBJECTS)
-tcpreplay_DEPENDENCIES = ./common/libcommon.a $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_2) $(am__append_2)
+@ENABLE_TCPREPLAY_EDIT_FALSE@tcpreplay_DEPENDENCIES =  \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	./common/libcommon.a \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	$(am__DEPENDENCIES_1) \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	$(am__DEPENDENCIES_2)
+@ENABLE_TCPREPLAY_EDIT_TRUE@tcpreplay_DEPENDENCIES =  \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	./tcpedit/libtcpedit.a \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	./common/libcommon.a \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	$(am__DEPENDENCIES_1) \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	$(am__DEPENDENCIES_2)
 tcpreplay_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(tcpreplay_CFLAGS) \
-	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+	$(CFLAGS) $(tcpreplay_LDFLAGS) $(LDFLAGS) -o $@
 am_tcprewrite_OBJECTS = tcprewrite-tcprewrite_opts.$(OBJEXT) \
 	tcprewrite-tcprewrite.$(OBJEXT)
 tcprewrite_OBJECTS = $(am_tcprewrite_OBJECTS)
+@COMPILE_FRAGROUTE_TRUE@am__DEPENDENCIES_3 =  \
+@COMPILE_FRAGROUTE_TRUE@	./fragroute/libfragroute.a
 tcprewrite_DEPENDENCIES = ./tcpedit/libtcpedit.a ./common/libcommon.a \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
+	$(am__DEPENDENCIES_3)
 tcprewrite_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(tcprewrite_CFLAGS) \
 	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
@@ -126,7 +137,7 @@ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
+DIST_SUBDIRS = common tcpedit fragroute
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -141,6 +152,7 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CUT = @CUT@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -148,6 +160,8 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DMALLOC_LIB = @DMALLOC_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -163,6 +177,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LDFLAGS = @LDFLAGS@
+LDNETINC = @LDNETINC@
+LDNETLIB = @LDNETLIB@
 LIBOBJS = @LIBOBJS@
 LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
 LIBOPTS_DIR = @LIBOPTS_DIR@
@@ -180,6 +196,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -256,11 +273,16 @@ target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
 tcpdump_path = @tcpdump_path@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+@COMPILE_FRAGROUTE_FALSE@LIBFRAGROUTE = 
 
 # $Id: Makefile.am 1632 2007-02-03 18:46:16Z aturner $
-SUBDIRS = common tcpedit
+@COMPILE_FRAGROUTE_TRUE@LIBFRAGROUTE = ./fragroute/libfragroute.a @LDNETLIB@
+@COMPILE_FRAGROUTE_FALSE@FRAGROUTE_DIR = 
+@COMPILE_FRAGROUTE_TRUE@FRAGROUTE_DIR = fragroute
+SUBDIRS = common tcpedit $(FRAGROUTE_DIR)
 @SYSTEM_STRLCPY_FALSE@LIBSTRL = ../lib/libstrl.a
 @SYSTEM_STRLCPY_TRUE@LIBSTRL = 
 
@@ -270,30 +292,42 @@ opts_list = -L tcpedit $(am__append_1)
 man_MANS = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 tcpreplay-edit.1
 EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 tcpreplay-edit.1
 tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPREPLAY
-tcpreplay_LDADD = ./common/libcommon.a $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ \
-	$(LIBOPTS_LDADD) $(am__append_2)
-tcpreplay_SOURCES = send_packets.c signal_handler.c tcpreplay.c \
-	$(am__append_3) $(am__append_4)
-tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
+@ENABLE_TCPREPLAY_EDIT_FALSE@tcpreplay_LDADD = ./common/libcommon.a \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	$(LIBSTRL) @LNETLIB@ @LPCAPLIB@ \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	$(LIBOPTS_LDADD)
+@ENABLE_TCPREPLAY_EDIT_TRUE@tcpreplay_LDADD = ./tcpedit/libtcpedit.a \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	./common/libcommon.a $(LIBSTRL) \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	@LNETLIB@ @LPCAPLIB@ \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	$(LIBOPTS_LDADD)
+@ENABLE_TCPREPLAY_EDIT_FALSE@tcpreplay_SOURCES = tcpreplay_opts.c \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	send_packets.c signal_handler.c \
+@ENABLE_TCPREPLAY_EDIT_FALSE@	tcpreplay.c sleep.c
+@ENABLE_TCPREPLAY_EDIT_TRUE@tcpreplay_SOURCES = tcpreplay_edit_opts.c \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	send_packets.c signal_handler.c \
+@ENABLE_TCPREPLAY_EDIT_TRUE@	tcpreplay.c sleep.c
+@ENABLE_OSX_FRAMEWORKS_TRUE@tcpreplay_LDFLAGS = -framework CoreServices -framework Carbon
+tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I.. @LDNETINC@ $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
 tcprewrite_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
-	$(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
+	$(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@ \
+	$(LIBFRAGROUTE)
 
 tcprewrite_SOURCES = tcprewrite_opts.c tcprewrite.c 
 tcpprep_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPPREP
 tcpprep_LDADD = ./common/libcommon.a \
-		  $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
+    $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
 
 tcpprep_SOURCES = tcpprep_opts.c tcpprep.c tree.c 
 tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPBRIDGE
 tcpbridge_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
-		  $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD)
+    $(LIBSTRL) @LNETLIB@ @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
 
-tcpbridge_SOURCES = tcpbridge_opts.c tcpbridge.c bridge.c send_packets.c 		
+@ENABLE_OSX_FRAMEWORKS_TRUE@tcpbridge_LDFLAGS = -framework CoreServices -framework Carbon
+tcpbridge_SOURCES = tcpbridge_opts.c tcpbridge.c bridge.c send_packets.c sleep.c
 noinst_HEADERS = tcpreplay.h tcpprep.h bridge.h defines.h tree.h \
 		 send_packets.h signal_handler.h common.h tcpreplay_opts.h \
 		 tcpreplay_edit_opts.h tcprewrite.h tcprewrite_opts.h tcpprep_opts.h \
 		 tcpprep_opts.def tcprewrite_opts.def tcpreplay_opts.def \
-		 tcpbridge_opts.def tcpbridge.h tcpbridge_opts.h tcpr.h
+		 tcpbridge_opts.def tcpbridge.h tcpbridge_opts.h tcpr.h sleep.h
 
 MOSTLYCLEANFILES = *~ *.o
 MAINTAINERCLEANFILES = Makefile.in tcpreplay_opts.h tcpreplay_opts.c \
@@ -365,8 +399,8 @@ install-binPROGRAMS: $(bin_PROGRAMS)
 	     || test -f $$p1 \
 	  ; then \
 	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
-	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
 	  else :; fi; \
 	done
 
@@ -405,6 +439,7 @@ distclean-compile:
 
 @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-sleep.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpbridge-tcpbridge.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpbridge-tcpbridge_opts.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpprep-tcpprep.Po@am__quote@
@@ -412,6 +447,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpprep-tree.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-send_packets.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-signal_handler.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-sleep.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-tcpreplay.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-tcpreplay_edit_opts.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpreplay-tcpreplay_opts.Po@am__quote@
@@ -495,6 +531,20 @@ tcpbridge-send_packets.obj: send_packets.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpbridge_CFLAGS) $(CFLAGS) -c -o tcpbridge-send_packets.obj `if test -f 'send_packets.c'; then $(CYGPATH_W) 'send_packets.c'; else $(CYGPATH_W) '$(srcdir)/send_packets.c'; fi`
 
+tcpbridge-sleep.o: sleep.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpbridge_CFLAGS) $(CFLAGS) -MT tcpbridge-sleep.o -MD -MP -MF $(DEPDIR)/tcpbridge-sleep.Tpo -c -o tcpbridge-sleep.o `test -f 'sleep.c' || echo '$(srcdir)/'`sleep.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpbridge-sleep.Tpo $(DEPDIR)/tcpbridge-sleep.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sleep.c' object='tcpbridge-sleep.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) $(tcpbridge_CFLAGS) $(CFLAGS) -c -o tcpbridge-sleep.o `test -f 'sleep.c' || echo '$(srcdir)/'`sleep.c
+
+tcpbridge-sleep.obj: sleep.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpbridge_CFLAGS) $(CFLAGS) -MT tcpbridge-sleep.obj -MD -MP -MF $(DEPDIR)/tcpbridge-sleep.Tpo -c -o tcpbridge-sleep.obj `if test -f 'sleep.c'; then $(CYGPATH_W) 'sleep.c'; else $(CYGPATH_W) '$(srcdir)/sleep.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpbridge-sleep.Tpo $(DEPDIR)/tcpbridge-sleep.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sleep.c' object='tcpbridge-sleep.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) $(tcpbridge_CFLAGS) $(CFLAGS) -c -o tcpbridge-sleep.obj `if test -f 'sleep.c'; then $(CYGPATH_W) 'sleep.c'; else $(CYGPATH_W) '$(srcdir)/sleep.c'; fi`
+
 tcpprep-tcpprep_opts.o: tcpprep_opts.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpprep_CFLAGS) $(CFLAGS) -MT tcpprep-tcpprep_opts.o -MD -MP -MF $(DEPDIR)/tcpprep-tcpprep_opts.Tpo -c -o tcpprep-tcpprep_opts.o `test -f 'tcpprep_opts.c' || echo '$(srcdir)/'`tcpprep_opts.c
 @am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpprep-tcpprep_opts.Tpo $(DEPDIR)/tcpprep-tcpprep_opts.Po
@@ -537,6 +587,20 @@ tcpprep-tree.obj: tree.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpprep_CFLAGS) $(CFLAGS) -c -o tcpprep-tree.obj `if test -f 'tree.c'; then $(CYGPATH_W) 'tree.c'; else $(CYGPATH_W) '$(srcdir)/tree.c'; fi`
 
+tcpreplay-tcpreplay_opts.o: tcpreplay_opts.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-tcpreplay_opts.o -MD -MP -MF $(DEPDIR)/tcpreplay-tcpreplay_opts.Tpo -c -o tcpreplay-tcpreplay_opts.o `test -f 'tcpreplay_opts.c' || echo '$(srcdir)/'`tcpreplay_opts.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpreplay-tcpreplay_opts.Tpo $(DEPDIR)/tcpreplay-tcpreplay_opts.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='tcpreplay_opts.c' object='tcpreplay-tcpreplay_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) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-tcpreplay_opts.o `test -f 'tcpreplay_opts.c' || echo '$(srcdir)/'`tcpreplay_opts.c
+
+tcpreplay-tcpreplay_opts.obj: tcpreplay_opts.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-tcpreplay_opts.obj -MD -MP -MF $(DEPDIR)/tcpreplay-tcpreplay_opts.Tpo -c -o tcpreplay-tcpreplay_opts.obj `if test -f 'tcpreplay_opts.c'; then $(CYGPATH_W) 'tcpreplay_opts.c'; else $(CYGPATH_W) '$(srcdir)/tcpreplay_opts.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpreplay-tcpreplay_opts.Tpo $(DEPDIR)/tcpreplay-tcpreplay_opts.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='tcpreplay_opts.c' object='tcpreplay-tcpreplay_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) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-tcpreplay_opts.obj `if test -f 'tcpreplay_opts.c'; then $(CYGPATH_W) 'tcpreplay_opts.c'; else $(CYGPATH_W) '$(srcdir)/tcpreplay_opts.c'; fi`
+
 tcpreplay-send_packets.o: send_packets.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-send_packets.o -MD -MP -MF $(DEPDIR)/tcpreplay-send_packets.Tpo -c -o tcpreplay-send_packets.o `test -f 'send_packets.c' || echo '$(srcdir)/'`send_packets.c
 @am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpreplay-send_packets.Tpo $(DEPDIR)/tcpreplay-send_packets.Po
@@ -579,6 +643,20 @@ tcpreplay-tcpreplay.obj: tcpreplay.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-tcpreplay.obj `if test -f 'tcpreplay.c'; then $(CYGPATH_W) 'tcpreplay.c'; else $(CYGPATH_W) '$(srcdir)/tcpreplay.c'; fi`
 
+tcpreplay-sleep.o: sleep.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-sleep.o -MD -MP -MF $(DEPDIR)/tcpreplay-sleep.Tpo -c -o tcpreplay-sleep.o `test -f 'sleep.c' || echo '$(srcdir)/'`sleep.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpreplay-sleep.Tpo $(DEPDIR)/tcpreplay-sleep.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sleep.c' object='tcpreplay-sleep.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) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-sleep.o `test -f 'sleep.c' || echo '$(srcdir)/'`sleep.c
+
+tcpreplay-sleep.obj: sleep.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-sleep.obj -MD -MP -MF $(DEPDIR)/tcpreplay-sleep.Tpo -c -o tcpreplay-sleep.obj `if test -f 'sleep.c'; then $(CYGPATH_W) 'sleep.c'; else $(CYGPATH_W) '$(srcdir)/sleep.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpreplay-sleep.Tpo $(DEPDIR)/tcpreplay-sleep.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sleep.c' object='tcpreplay-sleep.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) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-sleep.obj `if test -f 'sleep.c'; then $(CYGPATH_W) 'sleep.c'; else $(CYGPATH_W) '$(srcdir)/sleep.c'; fi`
+
 tcpreplay-tcpreplay_edit_opts.o: tcpreplay_edit_opts.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-tcpreplay_edit_opts.o -MD -MP -MF $(DEPDIR)/tcpreplay-tcpreplay_edit_opts.Tpo -c -o tcpreplay-tcpreplay_edit_opts.o `test -f 'tcpreplay_edit_opts.c' || echo '$(srcdir)/'`tcpreplay_edit_opts.c
 @am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpreplay-tcpreplay_edit_opts.Tpo $(DEPDIR)/tcpreplay-tcpreplay_edit_opts.Po
@@ -593,20 +671,6 @@ tcpreplay-tcpreplay_edit_opts.obj: tcpreplay_edit_opts.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-tcpreplay_edit_opts.obj `if test -f 'tcpreplay_edit_opts.c'; then $(CYGPATH_W) 'tcpreplay_edit_opts.c'; else $(CYGPATH_W) '$(srcdir)/tcpreplay_edit_opts.c'; fi`
 
-tcpreplay-tcpreplay_opts.o: tcpreplay_opts.c
-@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-tcpreplay_opts.o -MD -MP -MF $(DEPDIR)/tcpreplay-tcpreplay_opts.Tpo -c -o tcpreplay-tcpreplay_opts.o `test -f 'tcpreplay_opts.c' || echo '$(srcdir)/'`tcpreplay_opts.c
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpreplay-tcpreplay_opts.Tpo $(DEPDIR)/tcpreplay-tcpreplay_opts.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='tcpreplay_opts.c' object='tcpreplay-tcpreplay_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) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-tcpreplay_opts.o `test -f 'tcpreplay_opts.c' || echo '$(srcdir)/'`tcpreplay_opts.c
-
-tcpreplay-tcpreplay_opts.obj: tcpreplay_opts.c
-@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcpreplay_CFLAGS) $(CFLAGS) -MT tcpreplay-tcpreplay_opts.obj -MD -MP -MF $(DEPDIR)/tcpreplay-tcpreplay_opts.Tpo -c -o tcpreplay-tcpreplay_opts.obj `if test -f 'tcpreplay_opts.c'; then $(CYGPATH_W) 'tcpreplay_opts.c'; else $(CYGPATH_W) '$(srcdir)/tcpreplay_opts.c'; fi`
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcpreplay-tcpreplay_opts.Tpo $(DEPDIR)/tcpreplay-tcpreplay_opts.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='tcpreplay_opts.c' object='tcpreplay-tcpreplay_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) $(tcpreplay_CFLAGS) $(CFLAGS) -c -o tcpreplay-tcpreplay_opts.obj `if test -f 'tcpreplay_opts.c'; then $(CYGPATH_W) 'tcpreplay_opts.c'; else $(CYGPATH_W) '$(srcdir)/tcpreplay_opts.c'; fi`
-
 tcprewrite-tcprewrite_opts.o: tcprewrite_opts.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tcprewrite_CFLAGS) $(CFLAGS) -MT tcprewrite-tcprewrite_opts.o -MD -MP -MF $(DEPDIR)/tcprewrite-tcprewrite_opts.Tpo -c -o tcprewrite-tcprewrite_opts.o `test -f 'tcprewrite_opts.c' || echo '$(srcdir)/'`tcprewrite_opts.c
 @am__fastdepCC_TRUE@	mv -f $(DEPDIR)/tcprewrite-tcprewrite_opts.Tpo $(DEPDIR)/tcprewrite-tcprewrite_opts.Po
@@ -761,8 +825,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -787,8 +851,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { 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) \
@@ -798,13 +862,12 @@ ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS) config.h.in $(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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

+ 1 - 0
src/common.h

@@ -15,6 +15,7 @@
 #include "common/services.h"
 #include "common/utils.h"
 #include "common/xX.h"
+#include "common/rdtsc.h"
 #include "common/tcpdump.h"
 #include "common/timer.h"
 #include "common/abort.h"

BIN
src/common/._sendpacket.c


+ 2 - 2
src/common/Makefile.am

@@ -14,7 +14,7 @@ svn_version.c:
 libcommon_a_SOURCES = cidr.c err.c list.c cache.c services.c get.c \
 		      fakepcap.c fakepcapnav.c fakepoll.c xX.c utils.c \
 		      timer.c svn_version.c abort.c sendpacket.c \
-			  dlt_names.c mac.c interface.c
+			  dlt_names.c mac.c interface.c rdtsc.c
 
 if ENABLE_TCPDUMP
 libcommon_a_SOURCES += tcpdump.c
@@ -27,7 +27,7 @@ libcommon_a_LIBADD = ../../lib/libstrl.a
 noinst_HEADERS = cidr.h err.h list.h cache.h services.h get.h \
 		 fakepcap.h fakepcapnav.h fakepoll.h xX.h utils.h \
 		 tcpdump.h timer.h abort.h pcap_dlt.h sendpacket.h \
-		 dlt_names.h mac.h interface.h
+		 dlt_names.h mac.h interface.h rdtsc.h
 
 MOSTLYCLEANFILES = *~
 

+ 21 - 14
src/common/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -52,7 +52,7 @@ libcommon_a_DEPENDENCIES = ../../lib/libstrl.a
 am__libcommon_a_SOURCES_DIST = cidr.c err.c list.c cache.c services.c \
 	get.c fakepcap.c fakepcapnav.c fakepoll.c xX.c utils.c timer.c \
 	svn_version.c abort.c sendpacket.c dlt_names.c mac.c \
-	interface.c tcpdump.c
+	interface.c rdtsc.c tcpdump.c
 @ENABLE_TCPDUMP_TRUE@am__objects_1 = tcpdump.$(OBJEXT)
 am_libcommon_a_OBJECTS = cidr.$(OBJEXT) err.$(OBJEXT) list.$(OBJEXT) \
 	cache.$(OBJEXT) services.$(OBJEXT) get.$(OBJEXT) \
@@ -60,9 +60,9 @@ am_libcommon_a_OBJECTS = cidr.$(OBJEXT) err.$(OBJEXT) list.$(OBJEXT) \
 	xX.$(OBJEXT) utils.$(OBJEXT) timer.$(OBJEXT) \
 	svn_version.$(OBJEXT) abort.$(OBJEXT) sendpacket.$(OBJEXT) \
 	dlt_names.$(OBJEXT) mac.$(OBJEXT) interface.$(OBJEXT) \
-	$(am__objects_1)
+	rdtsc.$(OBJEXT) $(am__objects_1)
 libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -93,6 +93,7 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CUT = @CUT@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -100,6 +101,8 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DMALLOC_LIB = @DMALLOC_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -115,6 +118,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LDFLAGS = @LDFLAGS@
+LDNETINC = @LDNETINC@
+LDNETLIB = @LDNETLIB@
 LIBOBJS = @LIBOBJS@
 LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
 LIBOPTS_DIR = @LIBOPTS_DIR@
@@ -132,6 +137,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -208,6 +214,7 @@ target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
 tcpdump_path = @tcpdump_path@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
@@ -217,13 +224,13 @@ BUILT_SOURCES = svn_version.c
 libcommon_a_SOURCES = cidr.c err.c list.c cache.c services.c get.c \
 	fakepcap.c fakepcapnav.c fakepoll.c xX.c utils.c timer.c \
 	svn_version.c abort.c sendpacket.c dlt_names.c mac.c \
-	interface.c $(am__append_1)
+	interface.c rdtsc.c $(am__append_1)
 AM_CFLAGS = -I.. -I../.. $(LNAV_CFLAGS)
 libcommon_a_LIBADD = ../../lib/libstrl.a
 noinst_HEADERS = cidr.h err.h list.h cache.h services.h get.h \
 		 fakepcap.h fakepcapnav.h fakepoll.h xX.h utils.h \
 		 tcpdump.h timer.h abort.h pcap_dlt.h sendpacket.h \
-		 dlt_names.h mac.h interface.h
+		 dlt_names.h mac.h interface.h rdtsc.h
 
 MOSTLYCLEANFILES = *~
 MAINTAINERCLEANFILES = Makefile.in svn_version.c
@@ -287,6 +294,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mac.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdtsc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendpacket.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/services.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/svn_version.Po@am__quote@
@@ -327,8 +335,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -340,8 +348,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { 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) \
@@ -351,13 +359,12 @@ 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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

+ 1 - 1
src/common/cache.c

@@ -1,4 +1,4 @@
-/* $Id: cache.c 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: cache.c 1907 2007-10-05 23:24:38Z aturner $ */
 
 /*
  * Copyright (c) 2001-2005 Aaron Turner.

+ 5 - 1
src/common/err.h

@@ -1,4 +1,4 @@
-/* $Id: err.h 1817 2007-04-17 06:50:44Z aturner $ */
+/* $Id: err.h 1963 2008-01-23 18:21:40Z aturner $ */
 
 /*
  * err.h
@@ -58,6 +58,10 @@
  * notice() - Informational only via stderr, format string, one or more variables
  */
 
+/* gcc accepts __FUNCTION__, but C99 says use __func__.  Necessary for SunPro compiler */
+#if !defined(__GNUC__) && !defined(__FUNCTION__)
+#  define __FUNCTION__ __func__
+#endif
 
 #define dbg(x, y) _our_verbose_dbg(x, y, __FUNCTION__, __LINE__, __FILE__)
 void _our_verbose_dbg(int dbg_level, const char *string, const char *, 

+ 12 - 12
src/common/get.c

@@ -1,4 +1,4 @@
-/* $Id: get.c 1897 2007-08-25 04:57:38Z aturner $ */
+/* $Id: get.c 1991 2008-04-26 22:22:05Z aturner $ */
 
 /*
  * Copyright (c) 2001-2005 Aaron Turner.
@@ -110,9 +110,9 @@ get_l2protocol(const u_char *pktdata, const int datalen, const int datalink)
         switch (ether_type) {
         case ETHERTYPE_VLAN: /* 802.1q */
             vlan_hdr = (vlan_hdr_t *)pktdata;
-            return vlan_hdr->vlan_len;
+            return ntohs(vlan_hdr->vlan_len);
         default:
-            return ether_type; /* yes, return it in nbo */
+            return ether_type; /* yes, return it in host byte order */
         }
         break;
 
@@ -155,15 +155,15 @@ get_l2len(const u_char *pktdata, const int datalen, const int datalink)
         break;
 
     case DLT_EN10MB:
-        eth_hdr = (eth_hdr_t *)pktdata;
-        ether_type = ntohs(eth_hdr->ether_type);
-        switch (ether_type) {
-        case ETHERTYPE_VLAN:            /* 802.1q */
-            return TCPR_802_1Q_H;
-            break;
-        default:              /* ethernet */
-            return TCPR_ETH_H;
-            break;
+        eth_hdr = (struct tcpr_ethernet_hdr *)pktdata;
+        switch (ntohs(eth_hdr->ether_type)) {
+            case ETHERTYPE_VLAN:
+                return 18;
+                break;
+        
+            default:
+                return 14;
+                break;
         }
         break;
         

+ 1 - 1
src/common/interface.c

@@ -1,4 +1,4 @@
-/* $Id: interface.c 1928 2007-10-26 17:21:35Z aturner $ */
+/* $Id: interface.c 1927 2007-10-26 17:19:58Z aturner $ */
 
 /*
  * Copyright (c) 2007 Aaron Turner.

+ 79 - 0
src/common/rdtsc.c

@@ -0,0 +1,79 @@
+/* $Id:$ */
+
+/*
+ * Copyright (c) 2008 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 <sys/types.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/*
+ * returns the # of clicks/usec
+ */
+u_int64_t
+rdtsc_calibrate(u_int32_t mhz)
+{
+    static u_int64_t x = 0;
+    u_int64_t v = 0;
+    struct timeval start, end, diff;
+    u_int64_t x1, x2;
+    u_int16_t n;
+    
+    if (x != 0) {
+        return x;
+    } else if (mhz > 0 && x == 0) {
+        x = (u_int64_t)mhz;
+        notice("Using user specification of %llu Mhz", x);
+    } else {
+        /* haven't calculated clicks/usec yet */
+        for (n=0; n<16; ++n) {
+            gettimeofday(&start, 0);
+            x1 = rdtsc();
+
+            usleep(100000);
+
+            x2 = rdtsc();
+            gettimeofday(&end, 0);
+
+            timersub(&end, &start, &diff);
+
+            v = (x2 - x1)/(diff.tv_sec * 1000000 + diff.tv_usec);
+            x = x ? (x + v)/2 : v;
+        }
+        notice("Using guessimate of %llu Mhz", x);
+    }
+    return x;
+}

+ 125 - 0
src/common/rdtsc.h

@@ -0,0 +1,125 @@
+/* $Id:$ */
+
+/*
+ * Copyright (c) 2008 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.
+ */
+
+
+/*
+ * Read TimeStamp Counter (RDTSC)
+ * http://www-unix.mcs.anl.gov/~kazutomo/rdtsc.html
+ * I'm not really sure what the license is, but I'll assume Kazutomo Yoshii is 
+ * cool with me using it since he published it on his website.
+ * Should also check out: http://www.fftw.org/cycle.h
+ */
+
+#ifndef __RDTSC_H__
+#define __RDTSC_H__
+
+
+u_int64_t rdtsc_calibrate(u_int32_t mhz);
+
+#if defined(__i386__)
+#define HAVE_RDTSC 1
+
+static inline u_int64_t 
+rdtsc(void)
+{
+    u_int64_t x;
+    __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
+    return x;
+}
+
+#elif defined(__x86_64__)
+#define HAVE_RDTSC 1
+
+static inline u_int64_t 
+rdtsc(void)
+{
+    unsigned hi, lo;
+    __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
+    return ( (u_int64_t)lo)|( ((u_int64_t)hi)<<32 );
+}
+
+#elif defined(__powerpc__)
+#define HAVE_RDTSC 1
+
+static inline u_int64_t 
+rdtsc(void)
+{
+    u_int64_t result=0;
+    u_int32_t upper, lower,tmp;
+    __asm__ volatile(
+        "0:                  \n"
+        "\tmftbu   %0           \n"
+        "\tmftb    %1           \n"
+        "\tmftbu   %2           \n"
+        "\tcmpw    %2,%0        \n"
+        "\tbne     0b         \n"
+        : "=r"(upper),"=r"(lower),"=r"(tmp)
+        );
+    result = upper;
+    result = result<<32;
+    result = result|lower;
+
+    return(result);
+}
+
+#else
+
+/* do not HAVE_RDTSC for your platform */
+
+#endif
+
+/* only define rdtsc_sleep() if we have rdtsc() */
+#ifdef HAVE_RDTSC
+/*
+ * sleeps for sleep time, using the rdtsc counter for accuracy
+ * you need to call rdtsc_calibrate() BEFORE this or you'll sleep for 
+ * an additional .1 sec the very first time you call it.
+ */
+static inline void
+rdtsc_sleep(const struct timespec sleep)
+{
+    u_int64_t sleep_until;
+    u_int64_t now = 0;
+    static u_int64_t clicks_per_usec = 0;
+
+    sleep_until = rdtsc();
+    clicks_per_usec = clicks_per_usec > 0 ? clicks_per_usec : rdtsc_calibrate(0);
+    
+    sleep_until += clicks_per_usec * TIMESPEC_TO_MICROSEC(&sleep);
+    
+    while (now < sleep_until)
+        now = rdtsc();
+}
+#endif
+
+#endif /* __RDTSC_H__ */
+

+ 131 - 53
src/common/sendpacket.c

@@ -1,4 +1,4 @@
-/* $Id: sendpacket.c 1935 2007-11-01 16:46:28Z aturner $ */
+/* $Id: sendpacket.c 2024 2008-05-06 19:39:35Z aturner $ */
 
 /*
  * Copyright (c) 2006 Aaron Turner.
@@ -70,23 +70,43 @@
 #include "sendpacket.h"
 
 
-/* Allow users to force the injection method */
+/* Allow users to force the injection method, default is linux PF_PACKET */
+#define INJECT_METHOD "PF_PACKET send()"
+
 #ifdef FORCE_INJECT_LIBNET
+#undef HAVE_PF_PACKET
 #undef HAVE_PCAP_INJECT
 #undef HAVE_PCAP_SENDPACKET
 #undef HAVE_BPF
-#elif defined FORCE_INJECT_BPF
+#undef INJECT_METHOD
+#define INJECT_METHOD "libnet send()"
+#endif
+
+#ifdef FORCE_INJECT_BPF
 #undef HAVE_LIBNET
 #undef HAVE_PCAP_INJECT
 #undef HAVE_PCAP_SENDPACKET
-#elif defined FORCE_INJECT_PCAP_INJECT
+#undef HAVE_PF_PACKET
+#undef INJECT_METHOD
+#define INJECT_METHOD "bpf send()"
+#endif
+
+#ifdef FORCE_INJECT_PCAP_INJECT
 #undef HAVE_LIBNET
 #undef HAVE_PCAP_SENDPACKET
 #undef HAVE_BPF
-#elif defined FORCE_INJECT_PCAP_SENDPACKET
+#undef HAVE_PF_PACKET
+#undef INJECT_METHOD
+#define INJECT_METHOD "pcap_inject()"
+#endif
+
+#ifdef FORCE_INJECT_PCAP_SENDPACKET
 #undef HAVE_LIBNET
 #undef HAVE_PCAP_INJECT
 #undef HAVE_BPF
+#undef HAVE_PF_PACKET
+#undef INJECT_METHOD
+#define INJECT_METHOD "pcap_sendpacket()"
 #endif
 
 
@@ -171,6 +191,10 @@ extern volatile int didsig;
  * Note: it is theoretically possible to get a return code >0 and < len
  * which for most people would be considered an error (the packet wasn't fully sent)
  * so you may want to test for recode != len too.
+ *
+ * Most socket API's have two interesting errors: ENOBUFS & EAGAIN.  ENOBUFS
+ * is usually due to the kernel buffers being full.  EAGAIN happens when you
+ * try to send traffic faster then the PHY allows.
  */
 int
 sendpacket(sendpacket_t *sp, const u_char *data, size_t len)
@@ -188,36 +212,67 @@ TRY_SEND_AGAIN:
 
 #if defined HAVE_PF_PACKET 
     retcode = (int)send(sp->handle.fd, (void *)data, len, 0);
-        
-    /* out of buffers, silently retry */
-    if (retcode < 0 && errno == ENOBUFS && !didsig) {
-        sp->retry ++;
-        goto TRY_SEND_AGAIN;
+
+    /* out of buffers, or hit max PHY speed, silently retry */
+    if (retcode < 0 && !didsig) {
+        switch (errno) {
+            case EAGAIN:
+                sp->retry_eagain ++;
+                goto TRY_SEND_AGAIN;
+                break;
+            case ENOBUFS:
+                sp->retry_enobufs ++;
+                goto TRY_SEND_AGAIN;
+                break;
+                
+            default:
+                sendpacket_seterr(sp, "Error with %s [" COUNTER_SPEC "]: %s (errno = %d)", 
+                    INJECT_METHOD, sp->sent + 1, strerror(errno), errno);
+        }
     } 
-    /* some other kind of error */
-    else if (retcode < 0) {
-        sendpacket_seterr(sp, "Error with pf send(): %s (errno = %d)", 
-            strerror(errno), errno);
-    }
 
 #elif defined HAVE_BPF
     retcode = write(sp->handle.fd, (void *)data, len);
-    if (retcode < 0 && errno == ENOBUFS && !didsig) {
-        sp->retry ++;
-        goto TRY_SEND_AGAIN;
-    } else if (retcode < 0) {
-        sendpacket_seterr(sp, "Error with bpf write(): %s (errno = %d)", 
-            strerror(errno), errno);
+
+    /* out of buffers, or hit max PHY speed, silently retry */
+    if (retcode < 0 && !didsig) {
+        switch (errno) {
+            case EAGAIN:
+                sp->retry_eagain ++;
+                goto TRY_SEND_AGAIN;
+                break;
+
+            case ENOBUFS:
+                sp->retry_enobufs ++;
+                goto TRY_SEND_AGAIN;
+                break;
+                
+            default:
+                sendpacket_seterr(sp, "Error with %s [" COUNTER_SPEC "]: %s (errno = %d)", 
+                    INJECT_METHOD, sp->sent + 1, strerror(errno), errno);
+        }
     }
 
 #elif defined HAVE_LIBNET
     retcode = libnet_adv_write_link(sp->handle.lnet, (u_int8_t*)data, (u_int32_t)len);
-    if (retcode < 0 && errno == ENOBUFS && !didsig) {
-        sp->retry ++;
-        goto TRY_SEND_AGAIN;
-    } else if (retcode < 0) {
-        sendpacket_seterr(sp, "Error with libnet write: %s (errno = %d)", 
-            libnet_geterror(sp->handle.lnet), errno);
+
+    /* out of buffers, or hit max PHY speed, silently retry */
+    if (retcode < 0 && !didsig) {
+        switch (errno) {
+            case EAGAIN:
+                sp->retry_eagain ++;
+                goto TRY_SEND_AGAIN;
+                break;
+
+            case ENOBUFS:
+                sp->retry_enobufs ++;
+                goto TRY_SEND_AGAIN;
+                break;
+                
+            default:
+                sendpacket_seterr(sp, "Error with %s [" COUNTER_SPEC "]: %s (errno = %d)", 
+                    INJECT_METHOD, sp->sent + 1, strerror(errno), errno);
+        }
     }
 
 #elif defined HAVE_PCAP_INJECT
@@ -226,31 +281,51 @@ TRY_SEND_AGAIN:
      * is there a better way???
      */    
     retcode = pcap_inject(sp->handle.pcap, (void*)data, len);
-    if (retcode < 0 && errno == ENOBUFS && !didsig) {
-        sp->retry ++;
-        goto TRY_SEND_AGAIN;
-    } else if (retcode < 0) {
-        sendpacket_seterr(sp, "Error with pcap_inject(packet #" 
-            COUNTER_SPEC "): %s (errno = %d)", 
-            sp->sent + 1, pcap_geterr(sp->handle.pcap), errno);
+    /* out of buffers, or hit max PHY speed, silently retry */
+    if (retcode < 0 && !didsig) {
+        switch (errno) {
+            case EAGAIN:
+                sp->retry_eagain ++;
+                goto TRY_SEND_AGAIN;
+                break;
+
+            case ENOBUFS:
+                sp->retry_enobufs ++;
+                goto TRY_SEND_AGAIN;
+                break;
+                
+            default:
+                sendpacket_seterr(sp, "Error with %s [" COUNTER_SPEC "]: %s (errno = %d)", 
+                    INJECT_METHOD, sp->sent + 1, pcap_geterr(sp->handle.pcap), errno);
+        }
     }
 
 #elif defined HAVE_PCAP_SENDPACKET
     retcode = pcap_sendpacket(sp->handle.pcap, data, (int)len);
-    if (retcode < 0 && errno == ENOBUFS && !didsig) {
-        sp->retry ++;
-        goto TRY_SEND_AGAIN;
-    } else if (retcode < 0) {
-        sendpacket_seterr(sp, "Error with pcap_sendpacket(packet #" 
-            COUNTER_SPEC "): %s (errno = %d)",
-            sp->sent + 1, pcap_geterr(sp->handle.pcap), errno);
-    } else {
-        /* 
-         * pcap_sendpacket returns 0 on success, not the packet length! 
-         * hence, we have to fix retcode to be more standard on success
-         */
-        retcode = len;
+    /* out of buffers, or hit max PHY speed, silently retry */
+    if (retcode < 0 && !didsig) {
+        switch (errno) {
+            case EAGAIN:
+                sp->retry_eagain ++;
+                goto TRY_SEND_AGAIN;
+                break;
+
+            case ENOBUFS:
+                sp->retry_enobufs ++;
+                goto TRY_SEND_AGAIN;
+                break;
+                
+            default:
+                sendpacket_seterr(sp, "Error with %s [" COUNTER_SPEC "]: %s (errno = %d)", 
+                    INJECT_METHOD, sp->sent + 1, pcap_geterr(sp->handle.pcap), errno);
+         }
     }
+    /* 
+     * pcap_sendpacket returns 0 on success, not the packet length! 
+     * hence, we have to fix retcode to be more standard on success
+     */
+    if (retcode == 0)
+        retcode = len;
 
 #endif
 
@@ -307,11 +382,12 @@ sendpacket_getstat(sendpacket_t *sp)
     
     memset(buf, 0, sizeof(buf));
     sprintf(buf, "Statistics for network device: %s\n"
-        "\tAttempted packets:   " COUNTER_SPEC "\n"
-        "\tSuccessful packets:  " COUNTER_SPEC "\n"
-        "\tFailed packets:      " COUNTER_SPEC "\n"
-        "\tRetried packets:     " COUNTER_SPEC "\n",
-        sp->device, sp->attempt, sp->sent, sp->failed, sp->retry);
+        "\tAttempted packets:         " COUNTER_SPEC "\n"
+        "\tSuccessful packets:        " COUNTER_SPEC "\n"
+        "\tFailed packets:            " COUNTER_SPEC "\n"
+        "\tRetried packets (ENOBUFS): " COUNTER_SPEC "\n"
+        "\tRetried packets (EAGAIN):  " COUNTER_SPEC "\n",
+        sp->device, sp->attempt, sp->sent, sp->failed, sp->retry_enobufs, sp->retry_eagain);
     return(buf);
 }
 
@@ -544,6 +620,7 @@ sendpacket_open_pf(const char *device, char *errbuf)
         return NULL;
     }
 
+#if 0 /* why is this check necessary??? */
     /* make sure it's ethernet */
     switch (ifr.ifr_hwaddr.sa_family) {
         case ARPHRD_ETHER:
@@ -554,7 +631,8 @@ sendpacket_open_pf(const char *device, char *errbuf)
             close(mysocket);
             return NULL;
     }
-  
+#endif
+
 #ifdef SO_BROADCAST
     /*
      * man 7 socket

+ 3 - 2
src/common/sendpacket.h

@@ -1,4 +1,4 @@
-/* $Id: sendpacket.h 1786 2007-04-02 16:44:50Z aturner $ */
+/* $Id: sendpacket.h 2012 2008-05-03 18:54:02Z aturner $ */
 
 /*
  * Copyright (c) 2006 Aaron Turner.
@@ -54,7 +54,8 @@ struct sendpacket_s {
     int open;
     char device[20];
     char errbuf[SENDPACKET_ERRBUF_SIZE];
-    COUNTER retry;
+    COUNTER retry_enobufs;
+    COUNTER retry_eagain;
     COUNTER failed;
     COUNTER sent;
     COUNTER bytes_sent;

+ 1 - 1
src/common/svn_version.c

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

+ 12 - 16
src/common/timer.c

@@ -1,4 +1,4 @@
-/* $Id: timer.c 1897 2007-08-25 04:57:38Z aturner $ */
+/* $Id: timer.c 2006 2008-05-01 04:46:55Z aturner $ */
 
 /*
  * Copyright (c) 2001-2007 Aaron Turner.
@@ -56,20 +56,16 @@ timerdiv(struct timeval *tvp, float div)
     tvp->tv_usec = interval - (tvp->tv_sec * 1000000);
 }
 
-/*
- * converts a float to a timeval structure
- * converted to a #define
-void
-float2timer(float time, struct timeval *tvp)
+/* Divide tvs by div, storing the result in tvs */
+void timesdiv(struct timespec *tvs, float div)
 {
-    float n;
-
-    n = time;
-
-    tvp->tv_sec = n;
-
-    n -= tvp->tv_sec;
-    tvp->tv_usec = n * 100000;
-
+    double interval;
+    
+    if (div == 0 || div == 1)
+        return;
+        
+    interval = ((double)tvs->tv_sec * 1000000000 + tvs->tv_nsec) / (double)div;
+    tvs->tv_sec = interval / (int)1000000000;
+    tvs->tv_nsec = interval - (tvs->tv_nsec * 1000000000);
 }
- */
+

+ 127 - 10
src/common/timer.h

@@ -1,4 +1,4 @@
-/* $Id: timer.h 1854 2007-05-02 04:41:29Z aturner $ */
+/* $Id: timer.h 2006 2008-05-01 04:46:55Z aturner $ */
 
 /*
  * Copyright (c) 2001-2007 Aaron Turner.
@@ -42,13 +42,37 @@
 #include <sys/time.h>
 #include <math.h>
 
+#ifdef HAVE_ABSOLUTE_TIME
+#include <CoreServices/CoreServices.h>
+#endif
+
+/* AbsoluteTime methods */
+#ifndef NonZero
+#define NonZero(x) ((x).hi | (x).lo)
+#endif
+#ifndef SetZero
+#define SetZero(x) do { (x).hi = 0 ; (x).lo = 0; } while(0)
+#endif
+#ifndef CopyAbsolute
+#define CopyAbsolute(x, y) do { (x).lo = (y).lo ; (x).hi = (y).hi; } while (0)
+#endif
+#ifndef AbsoluteCmp
+#define AbsoluteCmp(left, right, cmp)       \
+	(((left)->hi == (right)->hi) ?		    \
+	((left)->lo cmp (right)->lo) :		    \
+	((left)->hi cmp (right)->hi))
+#endif
+
 /*
- * 1 sec = 1,000,000 microsec
+ * 1 sec = 1,0000 millisec (ms)
+ * 1 sec = 1,000,000 microsec (us)
+ * 1 sec = 1,000,000,000 nanosec (ns)
+ * 1 millisec = 1,000 microsec
  * 1 microsec = 1,000 nanosec
- * 1 sec = 1,000,000,000 nanosec
  */
 
 void timerdiv(struct timeval *tvp, float div);
+void timesdiv(struct timespec *tvs, float div);
 
 /* convert float time to struct timeval *tvp */
 #ifndef float2timer
@@ -56,7 +80,7 @@ void timerdiv(struct timeval *tvp, float div);
     do {                                        \
         tvp->tv_sec = time;                     \
         tvp->tv_usec = (time - tvp->tv_sec) * 100000; \
-    } while (0);
+    } while (0)
 #endif
 
 
@@ -66,16 +90,42 @@ void timerdiv(struct timeval *tvp, float div);
             (ts)->tv_nsec = (tv)->tv_usec * 1000; }
 #endif
 
+#ifndef TIMESPEC_TO_TIMEVAL
+#define TIMESPEC_TO_TIMEVAL(tv, ts) {           \
+    (tv)->tv_sec = (ts)->tv_sec;                \
+    (tv)->tv_usec = (ts)->tv_nsec / 1000; }
+#endif
+
+#ifndef ROUND_TIMESPEC_TO_MICROSEC
+#define ROUND_TIMESPEC_TO_MICROSEC(ts)      \
+    do {                                    \
+        (ts)->tv_nsec = ((((ts)->tv_nsec / 1000) + ((ts)->tv_nsec % 1000 >= 500 ? 1 : 0)) * 1000);   \
+    } while (0)
+#endif
+
+
+
 /* zero out a timer */
 #ifndef timerclear
 #define timerclear(tvp)		(tvp)->tv_sec = (tvp)->tv_usec = 0
 #endif
 
+/* zero out a timespec */
+#ifndef timesclear
+#define timesclear(tvs)     (tvs)->tv_sec = (tvs)->tv_nsec = 0
+#endif
+
 /* is timer non-zero? */
 #ifndef timerisset
 #define timerisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)
 #endif
 
+/* is timespec non-zero? */
+#ifndef timesisset
+#define timesisset(tvs)		((tvs)->tv_sec || (tvs)->tv_nsec)
+#endif
+
+
 /* add tvp and uvp and store in vvp */
 #ifndef timeradd
 #define timeradd(tvp, uvp, vvp)                 \
@@ -102,6 +152,18 @@ void timerdiv(struct timeval *tvp, float div);
 	} while (0)
 #endif
 
+#ifndef timessub
+#define	timessub(tsp, usp, vsp)					\
+	do {								        \
+		(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;		\
+		(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;	\
+		if ((vsp)->tv_nsec < 0) {				\
+			(vsp)->tv_sec--;				    \
+			(vsp)->tv_nsec += 1000000000;		\
+		}							            \
+	} while (0)
+#endif
+
 /* compare tvp and uvp using cmp */
 #ifndef timercmp
 #define timercmp(tvp, uvp, cmp)				    \
@@ -110,6 +172,13 @@ void timerdiv(struct timeval *tvp, float div);
 	((tvp)->tv_sec cmp (uvp)->tv_sec))
 #endif
 
+#ifndef timescmp
+#define timescmp(tsp, usp, cmp)				    \
+	(((tsp)->tv_sec == (usp)->tv_sec) ?		    \
+	((tsp)->tv_nsec cmp (usp)->tv_nsec) :		\
+	((tsp)->tv_sec cmp (usp)->tv_sec))
+#endif
+
 /* multiply tvp by x and store in uvp */
 #define timermul(tvp, uvp, x)					\
 	do {								        \
@@ -121,13 +190,61 @@ void timerdiv(struct timeval *tvp, float div);
 		}							            \
 	} while(0)
 
+#ifdef HAVE_ABSOLUTE_TIME
+    typedef AbsoluteTime delta_t;
+#else
+    typedef struct timeval delta_t;
+#endif
 
-/* device tvp by x.  store in tvp */
-#define timerdiv2(tvp, x)						\
-	do {								        \
-		(tvp)->tv_sec = (tvp)->tv_sec / x;		\
-		(tvp)->tv_usec = (tvp)->tv_usec / x;	\
-	} while(0)
+/*
+ * starts a timer so we can figure out how much time has passed
+ * when we call get_delta_timer()
+ */
+static inline void
+start_delta_time(delta_t *ctx)
+{
+#ifdef HAVE_ABSOLUTE_TIME
+    *ctx = UpTime();
+#else
+    gettimeofday(ctx, NULL);
+#endif
+}
 
+/* 
+ * returns the amount of time that has passed since the 
+ * last time you called start_delta_time()
+ */
+static inline void
+get_delta_time(delta_t *ctx, struct timespec *ret)
+{
+/* OS X has absolute time */
+#ifdef HAVE_ABSOLUTE_TIME
+    AbsoluteTime now, delta;
+    Nanoseconds nano;
+    
+    now = UpTime();
+    
+    if (! NonZero(*ctx)) {
+        timesclear(ret);
+    } else {
+        delta = SubAbsoluteFromAbsolute(now, *ctx);
+        nano = AbsoluteToNanoseconds(delta);
+        NANOSEC_TO_TIMESPEC(UnsignedWideToUInt64(nano) / 10, ret);
+    }
+    
+/* Everyone else just uses gettimeofday */
+#else
+    struct timeval now, delta;
+    
+    gettimeofday(&now, NULL);
+
+    if (!timerisset(ctx)) {
+        timesclear(ret);
+    } else {
+        timersub(&now, ctx, &delta);
+        TIMEVAL_TO_TIMESPEC(&delta, ret);
+    }
 #endif
+}
 
+#endif /* _TIMER_H_ */

+ 1 - 27
src/common/utils.c

@@ -1,4 +1,4 @@
-/* $Id: utils.c 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: utils.c 1948 2008-01-14 18:08:06Z aturner $ */
 
 /*
  * Copyright (c) 2001-2005 Aaron Turner.
@@ -210,32 +210,6 @@ read_hexstring(const char *l2string, u_char *hex, const int hexlen)
     return (numbytes);
 }
 
-/**
- * whorishly appropriated from fragroute-1.2.  Parse a string and 
- * create an argv[] array.
- */
-int
-argv_create(char *p, int argc, char *argv[])
-{
-    int i;
-
-    for (i = 0; i < argc - 1; i++) {
-        while (*p != '\0' && isspace((int)*p))
-            *p++ = '\0';
-
-        if (*p == '\0')
-            break;
-        argv[i] = p;
-
-        while (*p != '\0' && !isspace((int)*p))
-            p++;
-    }
-    p[0] = '\0';
-    argv[i] = NULL;
-
-    return (i);
-}
-
 #ifdef USE_CUSTOM_INET_ATON
 int
 inet_aton(const char *name, struct in_addr *addr)

+ 1 - 2
src/common/utils.h

@@ -1,4 +1,4 @@
-/* $Id: utils.h 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: utils.h 1948 2008-01-14 18:08:06Z aturner $ */
 
 /*
  * Copyright (c) 2001-2005 Aaron Turner.
@@ -39,7 +39,6 @@
 #include "common.h"
 
 int read_hexstring(const char *l2string, u_char *hex, const int hexlen);
-int argv_create(char *p, int argc, char *argv[]);
 void packet_stats(struct timeval *begin, struct timeval *end, 
                   COUNTER bytes_sent, COUNTER pkts_sent, COUNTER failed);
 

+ 12 - 0
src/config.h.in

@@ -3,15 +3,24 @@
 /* Enable debuging code and support for the -d option */
 #undef DEBUG
 
+/* Enable dmalloc function arg checking */
+#undef DMALLOC_FUNC_CHECK
+
 /* Enable Electric Fence memory debugger */
 #undef EFENCE
 
 /* Use 64bit packet counters */
 #undef ENABLE_64BITS
 
+/* Enable dmalloc */
+#undef ENABLE_DMALLOC
+
 /* Enable dynamically linking libs */
 #undef ENABLE_DYNAMIC_LINK
 
+/* Enable fragroute module */
+#undef ENABLE_FRAGROUTE
+
 /* Enable use of pcap_findalldevs() */
 #undef ENABLE_PCAP_FINDALLDEVS
 
@@ -118,6 +127,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Do we have libdnet? */
+#undef HAVE_LIBDNET
+
 /* Define to 1 if you have the `gen' library (-lgen). */
 #undef HAVE_LIBGEN
 

+ 71 - 1
src/defines.h

@@ -161,7 +161,8 @@ enum tcpprep_mode {
 #define MAC_STR(x) x[0], x[1], x[2], x[3], x[4], x[5]
 
 /* struct timeval print structs */
-#define TIMEVAL_FORMAT "%lu.%06lu"
+#define TIMEVAL_FORMAT "%lus %luusec"
+#define TIMESPEC_FORMAT "%lus %lunsec"
 
 /* force a word or half-word swap on both Big and Little endian systems */
 #ifndef SWAPLONG
@@ -203,4 +204,73 @@ enum tcpprep_mode {
 #endif
 #endif
 
+#ifndef HAVE_UINT8_T
+typedef u_int8_t uint8_t
+typedef u_int16_t uint16_t
+typedef u_int32_t uint32_t
+#endif
+
+/* Support for flexible arrays. */
+#undef __flexarr
+#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97))
+/* GCC 2.97 supports C99 flexible array members.  */
+# define __flexarr      []
+#else
+# ifdef __GNUC__
+#  define __flexarr     [0]
+# else
+#  if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#   define __flexarr    []
+#  elif defined(_WIN32)
+/* MS VC++ */
+#   define __flexarr    []
+#  else
+/* Some other non-C99 compiler. Approximate with [1]. */
+#   define __flexarr    [1]
+#  endif
+# endif
+#endif
+
+
+/* Time converters */
+#define SEC_TO_MILLISEC(x) (x * 1000)
+#define SEC_TO_MICROSEC(x) (x * 1000000)
+#define SEC_TO_NANOSEC(x)  ((u_int64_t)x * 1000000000)
+
+#define MILLISEC_TO_SEC(x) (x / 1000)
+#define MICROSEC_TO_SEC(x) (x / 1000000)
+#define NANOSEC_TO_SEC(x)  ((u_int64_t)x / 1000000000)
+
+#define TIMEVAL_TO_MILLISEC(x)  (((x)->tv_sec * 1000) + ((x)->tv_usec / 1000))
+#define TIMEVAL_TO_MICROSEC(x)  (((x)->tv_sec * 1000000) + (x)->tv_usec)
+#define TIMEVAL_TO_NANOSEC(x)   ((u_int64_t)((x)->tv_sec * 1000000000) + ((u_int64_t)(x)->tv_usec * 1000))
+
+#define MILLISEC_TO_TIMEVAL(x, tv)          \
+    do {                                    \
+        (tv)->tv_sec = (x) / 1000;          \
+        (tv)->tv_usec = (x * 1000) - ((tv)->tv_sec * 1000000);   \
+    } while(0)
+    
+#define MICROSEC_TO_TIMEVAL(x, tv)          \
+    do {                                    \
+        (tv)->tv_sec = (x) / 1000000;       \
+        (tv)->tv_usec = (x) - ((tv)->tv_sec * 1000000);   \
+    } while(0)
+
+#define NANOSEC_TO_TIMEVAL(x, tv)           \
+    do {                                    \
+        (tv)->tv_sec =  (x) / 1000000000;   \
+        (tv)->tv_usec = ((x) % 1000000000) / 1000);   \
+    } while(0)
+
+#define NANOSEC_TO_TIMESPEC(x, ts)          \
+    do {                                    \
+        (ts)->tv_sec = (x) / 1000000000;    \
+        (ts)->tv_nsec = (x) % 1000000000;   \
+    } while(0)
+
+#define TIMESPEC_TO_MILLISEC(x)  (((x)->tv_sec * 1000) + ((x)->tv_nsec / 1000000))
+#define TIMESPEC_TO_MICROSEC(x)  (((x)->tv_sec * 1000000) + (x)->tv_nsec / 1000)
+#define TIMESPEC_TO_NANOSEC(x) ((u_int64_t)((x)->tv_sec * 1000000000) + ((u_int64_t)(x)->tv_nsec))
+
 #endif /* DEFINES */

+ 71 - 1
src/defines.h.in

@@ -161,7 +161,8 @@ enum tcpprep_mode {
 #define MAC_STR(x) x[0], x[1], x[2], x[3], x[4], x[5]
 
 /* struct timeval print structs */
-#define TIMEVAL_FORMAT "%lu.%06lu"
+#define TIMEVAL_FORMAT "%lus %luusec"
+#define TIMESPEC_FORMAT "%lus %lunsec"
 
 /* force a word or half-word swap on both Big and Little endian systems */
 #ifndef SWAPLONG
@@ -203,4 +204,73 @@ enum tcpprep_mode {
 #endif
 #endif
 
+#ifndef HAVE_UINT8_T
+typedef u_int8_t uint8_t
+typedef u_int16_t uint16_t
+typedef u_int32_t uint32_t
+#endif
+
+/* Support for flexible arrays. */
+#undef __flexarr
+#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97))
+/* GCC 2.97 supports C99 flexible array members.  */
+# define __flexarr      []
+#else
+# ifdef __GNUC__
+#  define __flexarr     [0]
+# else
+#  if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#   define __flexarr    []
+#  elif defined(_WIN32)
+/* MS VC++ */
+#   define __flexarr    []
+#  else
+/* Some other non-C99 compiler. Approximate with [1]. */
+#   define __flexarr    [1]
+#  endif
+# endif
+#endif
+
+
+/* Time converters */
+#define SEC_TO_MILLISEC(x) (x * 1000)
+#define SEC_TO_MICROSEC(x) (x * 1000000)
+#define SEC_TO_NANOSEC(x)  ((u_int64_t)x * 1000000000)
+
+#define MILLISEC_TO_SEC(x) (x / 1000)
+#define MICROSEC_TO_SEC(x) (x / 1000000)
+#define NANOSEC_TO_SEC(x)  ((u_int64_t)x / 1000000000)
+
+#define TIMEVAL_TO_MILLISEC(x)  (((x)->tv_sec * 1000) + ((x)->tv_usec / 1000))
+#define TIMEVAL_TO_MICROSEC(x)  (((x)->tv_sec * 1000000) + (x)->tv_usec)
+#define TIMEVAL_TO_NANOSEC(x)   ((u_int64_t)((x)->tv_sec * 1000000000) + ((u_int64_t)(x)->tv_usec * 1000))
+
+#define MILLISEC_TO_TIMEVAL(x, tv)          \
+    do {                                    \
+        (tv)->tv_sec = (x) / 1000;          \
+        (tv)->tv_usec = (x * 1000) - ((tv)->tv_sec * 1000000);   \
+    } while(0)
+    
+#define MICROSEC_TO_TIMEVAL(x, tv)          \
+    do {                                    \
+        (tv)->tv_sec = (x) / 1000000;       \
+        (tv)->tv_usec = (x) - ((tv)->tv_sec * 1000000);   \
+    } while(0)
+
+#define NANOSEC_TO_TIMEVAL(x, tv)           \
+    do {                                    \
+        (tv)->tv_sec =  (x) / 1000000000;   \
+        (tv)->tv_usec = ((x) % 1000000000) / 1000);   \
+    } while(0)
+
+#define NANOSEC_TO_TIMESPEC(x, ts)          \
+    do {                                    \
+        (ts)->tv_sec = (x) / 1000000000;    \
+        (ts)->tv_nsec = (x) % 1000000000;   \
+    } while(0)
+
+#define TIMESPEC_TO_MILLISEC(x)  (((x)->tv_sec * 1000) + ((x)->tv_nsec / 1000000))
+#define TIMESPEC_TO_MICROSEC(x)  (((x)->tv_sec * 1000000) + (x)->tv_nsec / 1000)
+#define TIMESPEC_TO_NANOSEC(x) ((u_int64_t)((x)->tv_sec * 1000000000) + ((u_int64_t)(x)->tv_nsec))
+
 #endif /* DEFINES */

+ 29 - 0
src/fragroute/LICENSE

@@ -0,0 +1,29 @@
+  
+  Copyright (c) 2001, 2002 Dug Song <dugsong@monkey.org>
+  Copyright (c) 2008 Aaron Turner
+  All rights reserved, all wrongs reversed.
+
+  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. The names of the authors and copyright holders may not 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 AUTHOR 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.
+

+ 18 - 0
src/fragroute/Makefile.am

@@ -0,0 +1,18 @@
+noinst_LIBRARIES = libfragroute.a
+libfragroute_a_SOURCES = fragroute.c bget.c mod.c pkt.c argv.c \
+						 randutil.c mod_delay.c mod_drop.c mod_dup.c \
+						 mod_echo.c mod_ip_chaff.c mod_ip_frag.c mod_ip_opt.c \
+						 mod_ip_ttl.c mod_ip_tos.c mod_order.c mod_print.c \
+						 mod_tcp_chaff.c mod_tcp_opt.c mod_tcp_seg.c
+
+
+libfragroute_a_CFLAGS = -I.. -I../.. @LDNETINC@
+
+# libfragroute_a_LIBS = @LDNETLIB@
+
+noinst_HEADERS = bget.h mod.h pkt.h randutil.h fragroute.h argv.h \
+				 LICENSE README
+
+MOSTLYCLEANFILES = *~
+
+MAINTAINERCLEANFILES = Makefiles.in

+ 794 - 0
src/fragroute/Makefile.in

@@ -0,0 +1,794 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  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/fragroute
+DIST_COMMON = README $(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
+libfragroute_a_AR = $(AR) $(ARFLAGS)
+libfragroute_a_LIBADD =
+am_libfragroute_a_OBJECTS = libfragroute_a-fragroute.$(OBJEXT) \
+	libfragroute_a-bget.$(OBJEXT) libfragroute_a-mod.$(OBJEXT) \
+	libfragroute_a-pkt.$(OBJEXT) libfragroute_a-argv.$(OBJEXT) \
+	libfragroute_a-randutil.$(OBJEXT) \
+	libfragroute_a-mod_delay.$(OBJEXT) \
+	libfragroute_a-mod_drop.$(OBJEXT) \
+	libfragroute_a-mod_dup.$(OBJEXT) \
+	libfragroute_a-mod_echo.$(OBJEXT) \
+	libfragroute_a-mod_ip_chaff.$(OBJEXT) \
+	libfragroute_a-mod_ip_frag.$(OBJEXT) \
+	libfragroute_a-mod_ip_opt.$(OBJEXT) \
+	libfragroute_a-mod_ip_ttl.$(OBJEXT) \
+	libfragroute_a-mod_ip_tos.$(OBJEXT) \
+	libfragroute_a-mod_order.$(OBJEXT) \
+	libfragroute_a-mod_print.$(OBJEXT) \
+	libfragroute_a-mod_tcp_chaff.$(OBJEXT) \
+	libfragroute_a-mod_tcp_opt.$(OBJEXT) \
+	libfragroute_a-mod_tcp_seg.$(OBJEXT)
+libfragroute_a_OBJECTS = $(am_libfragroute_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
+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 = $(libfragroute_a_SOURCES)
+DIST_SOURCES = $(libfragroute_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@
+CUT = @CUT@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DMALLOC_LIB = @DMALLOC_LIB@
+DSYMUTIL = @DSYMUTIL@
+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@
+LDNETINC = @LDNETINC@
+LDNETLIB = @LDNETLIB@
+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@
+NMEDIT = @NMEDIT@
+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_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = libfragroute.a
+libfragroute_a_SOURCES = fragroute.c bget.c mod.c pkt.c argv.c \
+						 randutil.c mod_delay.c mod_drop.c mod_dup.c \
+						 mod_echo.c mod_ip_chaff.c mod_ip_frag.c mod_ip_opt.c \
+						 mod_ip_ttl.c mod_ip_tos.c mod_order.c mod_print.c \
+						 mod_tcp_chaff.c mod_tcp_opt.c mod_tcp_seg.c
+
+libfragroute_a_CFLAGS = -I.. -I../.. @LDNETINC@
+
+# libfragroute_a_LIBS = @LDNETLIB@
+noinst_HEADERS = bget.h mod.h pkt.h randutil.h fragroute.h argv.h \
+				 LICENSE README
+
+MOSTLYCLEANFILES = *~
+MAINTAINERCLEANFILES = Makefiles.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/fragroute/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/fragroute/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)
+libfragroute.a: $(libfragroute_a_OBJECTS) $(libfragroute_a_DEPENDENCIES) 
+	-rm -f libfragroute.a
+	$(libfragroute_a_AR) libfragroute.a $(libfragroute_a_OBJECTS) $(libfragroute_a_LIBADD)
+	$(RANLIB) libfragroute.a
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-argv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-bget.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-fragroute.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_delay.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_drop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_dup.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_echo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_ip_chaff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_ip_frag.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_ip_opt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_ip_tos.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_ip_ttl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_order.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_print.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_tcp_chaff.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_tcp_opt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-mod_tcp_seg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-pkt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfragroute_a-randutil.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 $@ $<
+
+libfragroute_a-fragroute.o: fragroute.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-fragroute.o -MD -MP -MF $(DEPDIR)/libfragroute_a-fragroute.Tpo -c -o libfragroute_a-fragroute.o `test -f 'fragroute.c' || echo '$(srcdir)/'`fragroute.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-fragroute.Tpo $(DEPDIR)/libfragroute_a-fragroute.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fragroute.c' object='libfragroute_a-fragroute.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-fragroute.o `test -f 'fragroute.c' || echo '$(srcdir)/'`fragroute.c
+
+libfragroute_a-fragroute.obj: fragroute.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-fragroute.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-fragroute.Tpo -c -o libfragroute_a-fragroute.obj `if test -f 'fragroute.c'; then $(CYGPATH_W) 'fragroute.c'; else $(CYGPATH_W) '$(srcdir)/fragroute.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-fragroute.Tpo $(DEPDIR)/libfragroute_a-fragroute.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='fragroute.c' object='libfragroute_a-fragroute.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-fragroute.obj `if test -f 'fragroute.c'; then $(CYGPATH_W) 'fragroute.c'; else $(CYGPATH_W) '$(srcdir)/fragroute.c'; fi`
+
+libfragroute_a-bget.o: bget.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-bget.o -MD -MP -MF $(DEPDIR)/libfragroute_a-bget.Tpo -c -o libfragroute_a-bget.o `test -f 'bget.c' || echo '$(srcdir)/'`bget.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-bget.Tpo $(DEPDIR)/libfragroute_a-bget.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='bget.c' object='libfragroute_a-bget.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-bget.o `test -f 'bget.c' || echo '$(srcdir)/'`bget.c
+
+libfragroute_a-bget.obj: bget.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-bget.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-bget.Tpo -c -o libfragroute_a-bget.obj `if test -f 'bget.c'; then $(CYGPATH_W) 'bget.c'; else $(CYGPATH_W) '$(srcdir)/bget.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-bget.Tpo $(DEPDIR)/libfragroute_a-bget.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='bget.c' object='libfragroute_a-bget.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-bget.obj `if test -f 'bget.c'; then $(CYGPATH_W) 'bget.c'; else $(CYGPATH_W) '$(srcdir)/bget.c'; fi`
+
+libfragroute_a-mod.o: mod.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod.Tpo -c -o libfragroute_a-mod.o `test -f 'mod.c' || echo '$(srcdir)/'`mod.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod.Tpo $(DEPDIR)/libfragroute_a-mod.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod.c' object='libfragroute_a-mod.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod.o `test -f 'mod.c' || echo '$(srcdir)/'`mod.c
+
+libfragroute_a-mod.obj: mod.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod.Tpo -c -o libfragroute_a-mod.obj `if test -f 'mod.c'; then $(CYGPATH_W) 'mod.c'; else $(CYGPATH_W) '$(srcdir)/mod.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod.Tpo $(DEPDIR)/libfragroute_a-mod.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod.c' object='libfragroute_a-mod.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod.obj `if test -f 'mod.c'; then $(CYGPATH_W) 'mod.c'; else $(CYGPATH_W) '$(srcdir)/mod.c'; fi`
+
+libfragroute_a-pkt.o: pkt.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-pkt.o -MD -MP -MF $(DEPDIR)/libfragroute_a-pkt.Tpo -c -o libfragroute_a-pkt.o `test -f 'pkt.c' || echo '$(srcdir)/'`pkt.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-pkt.Tpo $(DEPDIR)/libfragroute_a-pkt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='pkt.c' object='libfragroute_a-pkt.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-pkt.o `test -f 'pkt.c' || echo '$(srcdir)/'`pkt.c
+
+libfragroute_a-pkt.obj: pkt.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-pkt.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-pkt.Tpo -c -o libfragroute_a-pkt.obj `if test -f 'pkt.c'; then $(CYGPATH_W) 'pkt.c'; else $(CYGPATH_W) '$(srcdir)/pkt.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-pkt.Tpo $(DEPDIR)/libfragroute_a-pkt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='pkt.c' object='libfragroute_a-pkt.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-pkt.obj `if test -f 'pkt.c'; then $(CYGPATH_W) 'pkt.c'; else $(CYGPATH_W) '$(srcdir)/pkt.c'; fi`
+
+libfragroute_a-argv.o: argv.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-argv.o -MD -MP -MF $(DEPDIR)/libfragroute_a-argv.Tpo -c -o libfragroute_a-argv.o `test -f 'argv.c' || echo '$(srcdir)/'`argv.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-argv.Tpo $(DEPDIR)/libfragroute_a-argv.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='argv.c' object='libfragroute_a-argv.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-argv.o `test -f 'argv.c' || echo '$(srcdir)/'`argv.c
+
+libfragroute_a-argv.obj: argv.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-argv.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-argv.Tpo -c -o libfragroute_a-argv.obj `if test -f 'argv.c'; then $(CYGPATH_W) 'argv.c'; else $(CYGPATH_W) '$(srcdir)/argv.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-argv.Tpo $(DEPDIR)/libfragroute_a-argv.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='argv.c' object='libfragroute_a-argv.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-argv.obj `if test -f 'argv.c'; then $(CYGPATH_W) 'argv.c'; else $(CYGPATH_W) '$(srcdir)/argv.c'; fi`
+
+libfragroute_a-randutil.o: randutil.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-randutil.o -MD -MP -MF $(DEPDIR)/libfragroute_a-randutil.Tpo -c -o libfragroute_a-randutil.o `test -f 'randutil.c' || echo '$(srcdir)/'`randutil.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-randutil.Tpo $(DEPDIR)/libfragroute_a-randutil.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='randutil.c' object='libfragroute_a-randutil.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-randutil.o `test -f 'randutil.c' || echo '$(srcdir)/'`randutil.c
+
+libfragroute_a-randutil.obj: randutil.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-randutil.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-randutil.Tpo -c -o libfragroute_a-randutil.obj `if test -f 'randutil.c'; then $(CYGPATH_W) 'randutil.c'; else $(CYGPATH_W) '$(srcdir)/randutil.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-randutil.Tpo $(DEPDIR)/libfragroute_a-randutil.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='randutil.c' object='libfragroute_a-randutil.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-randutil.obj `if test -f 'randutil.c'; then $(CYGPATH_W) 'randutil.c'; else $(CYGPATH_W) '$(srcdir)/randutil.c'; fi`
+
+libfragroute_a-mod_delay.o: mod_delay.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_delay.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_delay.Tpo -c -o libfragroute_a-mod_delay.o `test -f 'mod_delay.c' || echo '$(srcdir)/'`mod_delay.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_delay.Tpo $(DEPDIR)/libfragroute_a-mod_delay.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_delay.c' object='libfragroute_a-mod_delay.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_delay.o `test -f 'mod_delay.c' || echo '$(srcdir)/'`mod_delay.c
+
+libfragroute_a-mod_delay.obj: mod_delay.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_delay.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_delay.Tpo -c -o libfragroute_a-mod_delay.obj `if test -f 'mod_delay.c'; then $(CYGPATH_W) 'mod_delay.c'; else $(CYGPATH_W) '$(srcdir)/mod_delay.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_delay.Tpo $(DEPDIR)/libfragroute_a-mod_delay.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_delay.c' object='libfragroute_a-mod_delay.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_delay.obj `if test -f 'mod_delay.c'; then $(CYGPATH_W) 'mod_delay.c'; else $(CYGPATH_W) '$(srcdir)/mod_delay.c'; fi`
+
+libfragroute_a-mod_drop.o: mod_drop.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_drop.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_drop.Tpo -c -o libfragroute_a-mod_drop.o `test -f 'mod_drop.c' || echo '$(srcdir)/'`mod_drop.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_drop.Tpo $(DEPDIR)/libfragroute_a-mod_drop.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_drop.c' object='libfragroute_a-mod_drop.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_drop.o `test -f 'mod_drop.c' || echo '$(srcdir)/'`mod_drop.c
+
+libfragroute_a-mod_drop.obj: mod_drop.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_drop.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_drop.Tpo -c -o libfragroute_a-mod_drop.obj `if test -f 'mod_drop.c'; then $(CYGPATH_W) 'mod_drop.c'; else $(CYGPATH_W) '$(srcdir)/mod_drop.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_drop.Tpo $(DEPDIR)/libfragroute_a-mod_drop.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_drop.c' object='libfragroute_a-mod_drop.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_drop.obj `if test -f 'mod_drop.c'; then $(CYGPATH_W) 'mod_drop.c'; else $(CYGPATH_W) '$(srcdir)/mod_drop.c'; fi`
+
+libfragroute_a-mod_dup.o: mod_dup.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_dup.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_dup.Tpo -c -o libfragroute_a-mod_dup.o `test -f 'mod_dup.c' || echo '$(srcdir)/'`mod_dup.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_dup.Tpo $(DEPDIR)/libfragroute_a-mod_dup.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_dup.c' object='libfragroute_a-mod_dup.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_dup.o `test -f 'mod_dup.c' || echo '$(srcdir)/'`mod_dup.c
+
+libfragroute_a-mod_dup.obj: mod_dup.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_dup.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_dup.Tpo -c -o libfragroute_a-mod_dup.obj `if test -f 'mod_dup.c'; then $(CYGPATH_W) 'mod_dup.c'; else $(CYGPATH_W) '$(srcdir)/mod_dup.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_dup.Tpo $(DEPDIR)/libfragroute_a-mod_dup.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_dup.c' object='libfragroute_a-mod_dup.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_dup.obj `if test -f 'mod_dup.c'; then $(CYGPATH_W) 'mod_dup.c'; else $(CYGPATH_W) '$(srcdir)/mod_dup.c'; fi`
+
+libfragroute_a-mod_echo.o: mod_echo.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_echo.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_echo.Tpo -c -o libfragroute_a-mod_echo.o `test -f 'mod_echo.c' || echo '$(srcdir)/'`mod_echo.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_echo.Tpo $(DEPDIR)/libfragroute_a-mod_echo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_echo.c' object='libfragroute_a-mod_echo.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_echo.o `test -f 'mod_echo.c' || echo '$(srcdir)/'`mod_echo.c
+
+libfragroute_a-mod_echo.obj: mod_echo.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_echo.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_echo.Tpo -c -o libfragroute_a-mod_echo.obj `if test -f 'mod_echo.c'; then $(CYGPATH_W) 'mod_echo.c'; else $(CYGPATH_W) '$(srcdir)/mod_echo.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_echo.Tpo $(DEPDIR)/libfragroute_a-mod_echo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_echo.c' object='libfragroute_a-mod_echo.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_echo.obj `if test -f 'mod_echo.c'; then $(CYGPATH_W) 'mod_echo.c'; else $(CYGPATH_W) '$(srcdir)/mod_echo.c'; fi`
+
+libfragroute_a-mod_ip_chaff.o: mod_ip_chaff.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_chaff.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_chaff.Tpo -c -o libfragroute_a-mod_ip_chaff.o `test -f 'mod_ip_chaff.c' || echo '$(srcdir)/'`mod_ip_chaff.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_chaff.Tpo $(DEPDIR)/libfragroute_a-mod_ip_chaff.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_chaff.c' object='libfragroute_a-mod_ip_chaff.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_chaff.o `test -f 'mod_ip_chaff.c' || echo '$(srcdir)/'`mod_ip_chaff.c
+
+libfragroute_a-mod_ip_chaff.obj: mod_ip_chaff.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_chaff.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_chaff.Tpo -c -o libfragroute_a-mod_ip_chaff.obj `if test -f 'mod_ip_chaff.c'; then $(CYGPATH_W) 'mod_ip_chaff.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_chaff.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_chaff.Tpo $(DEPDIR)/libfragroute_a-mod_ip_chaff.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_chaff.c' object='libfragroute_a-mod_ip_chaff.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_chaff.obj `if test -f 'mod_ip_chaff.c'; then $(CYGPATH_W) 'mod_ip_chaff.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_chaff.c'; fi`
+
+libfragroute_a-mod_ip_frag.o: mod_ip_frag.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_frag.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_frag.Tpo -c -o libfragroute_a-mod_ip_frag.o `test -f 'mod_ip_frag.c' || echo '$(srcdir)/'`mod_ip_frag.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_frag.Tpo $(DEPDIR)/libfragroute_a-mod_ip_frag.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_frag.c' object='libfragroute_a-mod_ip_frag.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_frag.o `test -f 'mod_ip_frag.c' || echo '$(srcdir)/'`mod_ip_frag.c
+
+libfragroute_a-mod_ip_frag.obj: mod_ip_frag.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_frag.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_frag.Tpo -c -o libfragroute_a-mod_ip_frag.obj `if test -f 'mod_ip_frag.c'; then $(CYGPATH_W) 'mod_ip_frag.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_frag.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_frag.Tpo $(DEPDIR)/libfragroute_a-mod_ip_frag.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_frag.c' object='libfragroute_a-mod_ip_frag.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_frag.obj `if test -f 'mod_ip_frag.c'; then $(CYGPATH_W) 'mod_ip_frag.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_frag.c'; fi`
+
+libfragroute_a-mod_ip_opt.o: mod_ip_opt.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_opt.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_opt.Tpo -c -o libfragroute_a-mod_ip_opt.o `test -f 'mod_ip_opt.c' || echo '$(srcdir)/'`mod_ip_opt.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_opt.Tpo $(DEPDIR)/libfragroute_a-mod_ip_opt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_opt.c' object='libfragroute_a-mod_ip_opt.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_opt.o `test -f 'mod_ip_opt.c' || echo '$(srcdir)/'`mod_ip_opt.c
+
+libfragroute_a-mod_ip_opt.obj: mod_ip_opt.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_opt.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_opt.Tpo -c -o libfragroute_a-mod_ip_opt.obj `if test -f 'mod_ip_opt.c'; then $(CYGPATH_W) 'mod_ip_opt.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_opt.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_opt.Tpo $(DEPDIR)/libfragroute_a-mod_ip_opt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_opt.c' object='libfragroute_a-mod_ip_opt.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_opt.obj `if test -f 'mod_ip_opt.c'; then $(CYGPATH_W) 'mod_ip_opt.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_opt.c'; fi`
+
+libfragroute_a-mod_ip_ttl.o: mod_ip_ttl.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_ttl.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_ttl.Tpo -c -o libfragroute_a-mod_ip_ttl.o `test -f 'mod_ip_ttl.c' || echo '$(srcdir)/'`mod_ip_ttl.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_ttl.Tpo $(DEPDIR)/libfragroute_a-mod_ip_ttl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_ttl.c' object='libfragroute_a-mod_ip_ttl.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_ttl.o `test -f 'mod_ip_ttl.c' || echo '$(srcdir)/'`mod_ip_ttl.c
+
+libfragroute_a-mod_ip_ttl.obj: mod_ip_ttl.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_ttl.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_ttl.Tpo -c -o libfragroute_a-mod_ip_ttl.obj `if test -f 'mod_ip_ttl.c'; then $(CYGPATH_W) 'mod_ip_ttl.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_ttl.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_ttl.Tpo $(DEPDIR)/libfragroute_a-mod_ip_ttl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_ttl.c' object='libfragroute_a-mod_ip_ttl.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_ttl.obj `if test -f 'mod_ip_ttl.c'; then $(CYGPATH_W) 'mod_ip_ttl.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_ttl.c'; fi`
+
+libfragroute_a-mod_ip_tos.o: mod_ip_tos.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_tos.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_tos.Tpo -c -o libfragroute_a-mod_ip_tos.o `test -f 'mod_ip_tos.c' || echo '$(srcdir)/'`mod_ip_tos.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_tos.Tpo $(DEPDIR)/libfragroute_a-mod_ip_tos.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_tos.c' object='libfragroute_a-mod_ip_tos.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_tos.o `test -f 'mod_ip_tos.c' || echo '$(srcdir)/'`mod_ip_tos.c
+
+libfragroute_a-mod_ip_tos.obj: mod_ip_tos.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_ip_tos.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_ip_tos.Tpo -c -o libfragroute_a-mod_ip_tos.obj `if test -f 'mod_ip_tos.c'; then $(CYGPATH_W) 'mod_ip_tos.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_tos.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_ip_tos.Tpo $(DEPDIR)/libfragroute_a-mod_ip_tos.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_ip_tos.c' object='libfragroute_a-mod_ip_tos.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_ip_tos.obj `if test -f 'mod_ip_tos.c'; then $(CYGPATH_W) 'mod_ip_tos.c'; else $(CYGPATH_W) '$(srcdir)/mod_ip_tos.c'; fi`
+
+libfragroute_a-mod_order.o: mod_order.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_order.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_order.Tpo -c -o libfragroute_a-mod_order.o `test -f 'mod_order.c' || echo '$(srcdir)/'`mod_order.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_order.Tpo $(DEPDIR)/libfragroute_a-mod_order.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_order.c' object='libfragroute_a-mod_order.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_order.o `test -f 'mod_order.c' || echo '$(srcdir)/'`mod_order.c
+
+libfragroute_a-mod_order.obj: mod_order.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_order.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_order.Tpo -c -o libfragroute_a-mod_order.obj `if test -f 'mod_order.c'; then $(CYGPATH_W) 'mod_order.c'; else $(CYGPATH_W) '$(srcdir)/mod_order.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_order.Tpo $(DEPDIR)/libfragroute_a-mod_order.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_order.c' object='libfragroute_a-mod_order.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_order.obj `if test -f 'mod_order.c'; then $(CYGPATH_W) 'mod_order.c'; else $(CYGPATH_W) '$(srcdir)/mod_order.c'; fi`
+
+libfragroute_a-mod_print.o: mod_print.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_print.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_print.Tpo -c -o libfragroute_a-mod_print.o `test -f 'mod_print.c' || echo '$(srcdir)/'`mod_print.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_print.Tpo $(DEPDIR)/libfragroute_a-mod_print.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_print.c' object='libfragroute_a-mod_print.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_print.o `test -f 'mod_print.c' || echo '$(srcdir)/'`mod_print.c
+
+libfragroute_a-mod_print.obj: mod_print.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_print.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_print.Tpo -c -o libfragroute_a-mod_print.obj `if test -f 'mod_print.c'; then $(CYGPATH_W) 'mod_print.c'; else $(CYGPATH_W) '$(srcdir)/mod_print.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_print.Tpo $(DEPDIR)/libfragroute_a-mod_print.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_print.c' object='libfragroute_a-mod_print.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_print.obj `if test -f 'mod_print.c'; then $(CYGPATH_W) 'mod_print.c'; else $(CYGPATH_W) '$(srcdir)/mod_print.c'; fi`
+
+libfragroute_a-mod_tcp_chaff.o: mod_tcp_chaff.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_tcp_chaff.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_tcp_chaff.Tpo -c -o libfragroute_a-mod_tcp_chaff.o `test -f 'mod_tcp_chaff.c' || echo '$(srcdir)/'`mod_tcp_chaff.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_tcp_chaff.Tpo $(DEPDIR)/libfragroute_a-mod_tcp_chaff.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_tcp_chaff.c' object='libfragroute_a-mod_tcp_chaff.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_tcp_chaff.o `test -f 'mod_tcp_chaff.c' || echo '$(srcdir)/'`mod_tcp_chaff.c
+
+libfragroute_a-mod_tcp_chaff.obj: mod_tcp_chaff.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_tcp_chaff.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_tcp_chaff.Tpo -c -o libfragroute_a-mod_tcp_chaff.obj `if test -f 'mod_tcp_chaff.c'; then $(CYGPATH_W) 'mod_tcp_chaff.c'; else $(CYGPATH_W) '$(srcdir)/mod_tcp_chaff.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_tcp_chaff.Tpo $(DEPDIR)/libfragroute_a-mod_tcp_chaff.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_tcp_chaff.c' object='libfragroute_a-mod_tcp_chaff.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_tcp_chaff.obj `if test -f 'mod_tcp_chaff.c'; then $(CYGPATH_W) 'mod_tcp_chaff.c'; else $(CYGPATH_W) '$(srcdir)/mod_tcp_chaff.c'; fi`
+
+libfragroute_a-mod_tcp_opt.o: mod_tcp_opt.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_tcp_opt.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_tcp_opt.Tpo -c -o libfragroute_a-mod_tcp_opt.o `test -f 'mod_tcp_opt.c' || echo '$(srcdir)/'`mod_tcp_opt.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_tcp_opt.Tpo $(DEPDIR)/libfragroute_a-mod_tcp_opt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_tcp_opt.c' object='libfragroute_a-mod_tcp_opt.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_tcp_opt.o `test -f 'mod_tcp_opt.c' || echo '$(srcdir)/'`mod_tcp_opt.c
+
+libfragroute_a-mod_tcp_opt.obj: mod_tcp_opt.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_tcp_opt.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_tcp_opt.Tpo -c -o libfragroute_a-mod_tcp_opt.obj `if test -f 'mod_tcp_opt.c'; then $(CYGPATH_W) 'mod_tcp_opt.c'; else $(CYGPATH_W) '$(srcdir)/mod_tcp_opt.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_tcp_opt.Tpo $(DEPDIR)/libfragroute_a-mod_tcp_opt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_tcp_opt.c' object='libfragroute_a-mod_tcp_opt.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_tcp_opt.obj `if test -f 'mod_tcp_opt.c'; then $(CYGPATH_W) 'mod_tcp_opt.c'; else $(CYGPATH_W) '$(srcdir)/mod_tcp_opt.c'; fi`
+
+libfragroute_a-mod_tcp_seg.o: mod_tcp_seg.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_tcp_seg.o -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_tcp_seg.Tpo -c -o libfragroute_a-mod_tcp_seg.o `test -f 'mod_tcp_seg.c' || echo '$(srcdir)/'`mod_tcp_seg.c
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_tcp_seg.Tpo $(DEPDIR)/libfragroute_a-mod_tcp_seg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_tcp_seg.c' object='libfragroute_a-mod_tcp_seg.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_tcp_seg.o `test -f 'mod_tcp_seg.c' || echo '$(srcdir)/'`mod_tcp_seg.c
+
+libfragroute_a-mod_tcp_seg.obj: mod_tcp_seg.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfragroute_a_CFLAGS) $(CFLAGS) -MT libfragroute_a-mod_tcp_seg.obj -MD -MP -MF $(DEPDIR)/libfragroute_a-mod_tcp_seg.Tpo -c -o libfragroute_a-mod_tcp_seg.obj `if test -f 'mod_tcp_seg.c'; then $(CYGPATH_W) 'mod_tcp_seg.c'; else $(CYGPATH_W) '$(srcdir)/mod_tcp_seg.c'; fi`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libfragroute_a-mod_tcp_seg.Tpo $(DEPDIR)/libfragroute_a-mod_tcp_seg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mod_tcp_seg.c' object='libfragroute_a-mod_tcp_seg.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) $(libfragroute_a_CFLAGS) $(CFLAGS) -c -o libfragroute_a-mod_tcp_seg.obj `if test -f 'mod_tcp_seg.c'; then $(CYGPATH_W) 'mod_tcp_seg.c'; else $(CYGPATH_W) '$(srcdir)/mod_tcp_seg.c'; fi`
+
+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; nonemtpy = 1; } \
+	      END { if (nonempty) { 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; nonempty = 1; } \
+	      END { if (nonempty) { 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=; \
+	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; nonempty = 1; } \
+	      END { if (nonempty) { 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:

+ 33 - 0
src/fragroute/README

@@ -0,0 +1,33 @@
+This code is heavily based on, even stolen from Dug Song's excellent fragroute 
+utility.  I've taken a perfectly good application and converted it into a 
+packet editing library for my own needs.  Any bugs are my fault.  Any praises
+really should go to Dug.  
+
+Please consider all files here under the original fragroute LICENSE, with the
+added caveat that any changes are:
+
+Copyright 2008, Aaron Turner
+
+
+Notes:
+Fragroute runs as a daemon which intercepts packets by modifying the host
+operating systems routing table, redirecting packets destined to the target
+IP over the loopback interface.  Packets reaching the loopback interface
+are then read using libpcap/BPF filter processed according to the fragroute
+rule set and then resent out the configured interface.
+
+libfragroute works differently.  First, we do away with any changes to the
+host routing table.  Secondly, packets are not sent out any interface, but 
+are read back by the caller.  The API should look something like this:
+
+ctx = fragroute_init(mtu, <rules>); // init library
+
+// process a packet
+fragroute_process(ctx, char *pktbuff, int pktsize)
+
+// read resulting fragments
+while ((ret = fragroute_read(ctx, char **fragment)) > 0) {
+    // do something with fragment
+} else {
+    // no more fragments
+}

+ 68 - 0
src/fragroute/argv.c

@@ -0,0 +1,68 @@
+/*
+ * argv.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: argv.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "argv.h"
+
+int
+argv_create(char *p, int argc, char *argv[])
+{
+	int i;
+	
+	for (i = 0; i < argc - 1; i++) {
+		while (*p != '\0' && isspace((int)*p))
+			*p++ = '\0';
+		
+		if (*p == '\0')
+			break;
+		argv[i] = p;
+		
+		while (*p != '\0' && !isspace((int)*p))
+			p++;
+	}
+	p[0] = '\0';
+	argv[i] = NULL;
+	
+	return (i);
+}
+
+/* XXX - from tcpdump util.c. */
+char *
+argv_copy(char *argv[])
+{
+	char **p, *buf, *src, *dst;
+	int len = 0;
+	
+	p = argv;
+	if (*p == 0)
+		return (NULL);
+	
+	while (*p)
+		len += strlen(*p++) + 1;
+	
+	if ((buf = (char *)malloc(len)) == NULL)
+		return (NULL);
+	
+	p = argv;
+	dst = buf;
+	
+	while ((src = *p++) != NULL) {
+		while ((*dst++ = *src++) != '\0')
+			;
+		dst[-1] = ' ';
+	}
+	dst[-1] = '\0';
+	
+	return (buf);
+}

+ 15 - 0
src/fragroute/argv.h

@@ -0,0 +1,15 @@
+/*
+ * argv.h
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: argv.h 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#ifndef ARGV_H
+#define ARGV_H
+
+int	 argv_create(char *p, int argc, char *argv[]);
+char	*argv_copy(char *argv[]);
+
+#endif /* ARGV_H */

File diff suppressed because it is too large
+ 1592 - 0
src/fragroute/bget.c


+ 30 - 0
src/fragroute/bget.h

@@ -0,0 +1,30 @@
+/*
+
+    Interface definitions for bget.c, the memory management package.
+
+*/
+
+#ifndef _
+#ifdef PROTOTYPES
+#define  _(x)  x		      /* If compiler knows prototypes */
+#else
+#define  _(x)  ()                     /* It it doesn't */
+#endif /* PROTOTYPES */
+#endif
+
+typedef long bufsize;
+void	bpool	    _((void *buffer, bufsize len));
+void   *bget	    _((bufsize size));
+void   *bgetz	    _((bufsize size));
+void   *bgetr	    _((void *buffer, bufsize newsize));
+void	brel	    _((void *buf));
+void	bectl	    _((int (*compact)(bufsize sizereq, int sequence),
+		       void *(*acquire)(bufsize size),
+		       void (*release)(void *buf), bufsize pool_incr));
+void	bstats	    _((bufsize *curalloc, bufsize *totfree, bufsize *maxfree,
+		       long *nget, long *nrel));
+void	bstatse     _((bufsize *pool_incr, long *npool, long *npget,
+		       long *nprel, long *ndget, long *ndrel));
+void	bufdump     _((void *buf));
+void	bpoold	    _((void *pool, int dumpalloc, int dumpfree));
+int	bpoolv	    _((void *pool));

+ 141 - 0
src/fragroute/fragroute.c

@@ -0,0 +1,141 @@
+/*
+ * fragroute.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ * Copyright (c) 2007-2008 Aaron Turner.
+ * $Id: fragroute.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+#include "defines.h"
+#include "common.h"
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* need to undef these which are pulled in via defines.h, prior to importing dnet.h */
+#undef icmp_id
+#undef icmp_seq
+#undef icmp_data
+#undef icmp_mask
+#include <dnet.h>
+
+#include "fragroute.h"
+#include "pkt.h"
+#include "mod.h"
+// #include "tun.h"
+
+void
+fragroute_close(fragroute_t *ctx)
+{
+    free(ctx->pktq);
+    free(ctx);
+    ctx = NULL;
+}
+
+
+int
+fragroute_process(fragroute_t *ctx, void *buf, size_t len)
+{
+    struct pkt *pkt;
+    int l2len;
+    assert(ctx);
+    assert(buf);
+    
+    ctx->first_packet = 0;
+    /* save the l2 header of the original packet for later */
+    ctx->l2len = get_l2len(buf, len, ctx->dlt);
+    memcpy(ctx->l2header, buf, ctx->l2len);
+    
+	if ((pkt = pkt_new()) == NULL) {
+		strcpy(ctx->errbuf, "unable to pkt_new()");
+		return -1;
+	}
+	if (len > PKT_BUF_LEN) {
+        sprintf(ctx->errbuf, "skipping oversized packet: %zu", len);
+		return -1;
+	}
+
+    memcpy(pkt->pkt_data, buf, len);
+    pkt->pkt_end = pkt->pkt_data + len;
+	
+	pkt_decorate(pkt);
+	
+	if (pkt->pkt_ip == NULL) {
+		strcpy(ctx->errbuf, "skipping non-IP packet");
+		return -1;
+	}
+	ip_checksum(pkt->pkt_ip, len);
+
+	TAILQ_INIT(ctx->pktq);
+	TAILQ_INSERT_TAIL(ctx->pktq, pkt, pkt_next);
+	
+	mod_apply(ctx->pktq);
+
+    return 0;
+}
+
+/*
+ * keep calling this after fragroute_process() to get all the fragments.
+ * Each call returns the fragment length which is stored in **packet.
+ * Returns 0 when no more fragments remain or -1 on error
+ */
+int
+fragroute_getfragment(fragroute_t *ctx, char **packet)
+{
+    static struct pkt *pkt = NULL;
+    static struct pkt *next = NULL;
+    char *pkt_data = *packet;
+    u_int32_t length;
+    
+    if (ctx->first_packet != 0) {
+        pkt = next;
+    } else {
+        ctx->first_packet = 1;
+        pkt = TAILQ_FIRST(ctx->pktq);
+    }
+    
+    if (pkt != TAILQ_END(&(ctx->pktq))) {
+        next = TAILQ_NEXT(pkt, pkt_next);
+        memcpy(pkt_data, pkt->pkt_data, pkt->pkt_end - pkt->pkt_data);
+        
+        /* return the original L2 header */
+        memcpy(pkt_data, ctx->l2header, ctx->l2len);
+        length = pkt->pkt_end - pkt->pkt_data;
+        pkt = next;
+        return length;
+    }
+
+    return 0; // nothing
+}
+
+fragroute_t *
+fragroute_init(const int mtu, const int dlt, const char *config, char *errbuf)
+{
+    fragroute_t *ctx;
+
+    if (dlt != DLT_EN10MB) {
+        sprintf(errbuf, "Fragroute only supports DLT_EN10MB pcap files");
+        return NULL;
+    }
+        
+
+    ctx = (fragroute_t *)safe_malloc(sizeof(fragroute_t));
+    ctx->pktq = (struct pktq *)safe_malloc(sizeof(struct pktq));
+    ctx->dlt = dlt;
+    
+	pkt_init(128);
+
+    ctx->mtu = mtu;
+
+	/* parse the config */
+	if (mod_open(config, errbuf) < 0) {
+        fragroute_close(ctx);
+        return NULL;
+	}
+	
+    return ctx;
+}

+ 69 - 0
src/fragroute/fragroute.h

@@ -0,0 +1,69 @@
+/* $Id: fragroute.h 2000 2008-04-27 06:17:35Z aturner $ */
+
+/*
+ * Copyright (c) 2007-2008 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 "pkt.h"
+
+#ifndef __FRAGROUTE_H__
+#define __FRAGROUTE_H__
+
+#define FRAGROUTE_ERRBUF_LEN 1024
+
+/* Fragroute context. */
+struct fragroute_s {
+	struct addr	 src;
+	struct addr	 dst;
+	struct addr	 smac;
+	struct addr	 dmac;
+    int     dlt;
+	int		mtu;
+    int     first_packet; /* have we called getfragment() yet after process()? */
+    int     l2len;
+    u_char  l2header[50];
+//	arp_t		*arp;
+//	eth_t		*eth;
+//	intf_t		*intf;
+//	route_t		*route;
+//	tun_t		*tun;
+    char        errbuf[FRAGROUTE_ERRBUF_LEN];
+	struct pktq *pktq; /* packet chain */    
+};
+
+typedef struct fragroute_s fragroute_t;
+
+int fragroute_process(fragroute_t *ctx, void *buf, size_t len);
+int fragroute_getfragment(fragroute_t *ctx, char **packet);
+fragroute_t * fragroute_init(const int mtu, const int dlt, const char *config, char *errbuf);
+void fragroute_close(fragroute_t *ctx);
+
+#endif /* __FRAGROUTE_H__ */

+ 183 - 0
src/fragroute/mod.c

@@ -0,0 +1,183 @@
+/*
+ * mod.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ * Copyright (c) 2007-2008 Aaron Turner.
+ *
+ * $Id: mod.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+#include "defines.h"
+#include "common.h"
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "argv.h"
+#include "mod.h"
+
+#define MAX_ARGS		 128	/* XXX */
+
+struct rule {
+	struct mod		*mod;
+	void			*data;
+	TAILQ_ENTRY(rule)	 next;
+};
+
+/*
+ * XXX - new modules must be registered here.
+ */
+extern struct mod	 mod_delay;
+extern struct mod	 mod_drop;
+extern struct mod	 mod_dup;
+extern struct mod	 mod_echo;
+extern struct mod	 mod_ip_chaff;
+extern struct mod	 mod_ip_frag;
+extern struct mod	 mod_ip_opt;
+extern struct mod	 mod_ip_ttl;
+extern struct mod	 mod_ip_tos;
+extern struct mod	 mod_order;
+extern struct mod	 mod_print;
+extern struct mod	 mod_tcp_chaff;
+extern struct mod	 mod_tcp_opt;
+extern struct mod	 mod_tcp_seg;
+
+static struct mod *mods[] = {
+	&mod_delay,
+	&mod_drop,
+	&mod_dup,
+	&mod_echo,
+	&mod_ip_chaff,
+	&mod_ip_frag,
+	&mod_ip_opt,
+	&mod_ip_ttl,
+	&mod_ip_tos,
+	&mod_order,
+	&mod_print,
+	&mod_tcp_chaff,
+	&mod_tcp_opt,
+	&mod_tcp_seg,
+	NULL
+};
+
+static TAILQ_HEAD(head, rule) rules;
+
+void
+mod_usage(void)
+{
+	struct mod **m;
+
+	for (m = mods; *m != NULL; m++) {
+		fprintf(stderr, "       %s\n", (*m)->usage);
+	}
+}
+
+int
+mod_open(const char *script, char *errbuf)
+{
+	FILE *fp;
+	struct mod **m;
+	struct rule *rule;
+	char *argv[MAX_ARGS], buf[BUFSIZ];
+	int i, argc, ret = 0;
+
+	TAILQ_INIT(&rules);
+	
+	/* open the config/script file */
+	if ((fp = fopen(script, "r")) == NULL) {
+		sprintf(errbuf, "couldn't open %s", script);
+		return (-1);
+	}
+    dbg(1, "opened config file...");
+	/* read the file, one line at a time... */
+	for (i = 1; fgets(buf, sizeof(buf), fp) != NULL; i++) {
+	    
+	    /* skip comments & blank lines */
+		if (*buf == '#' || *buf == '\r' || *buf == '\n')
+			continue;
+		
+		/* parse the line into an array */
+		if ((argc = argv_create(buf, MAX_ARGS, argv)) < 1) {
+			sprintf(errbuf, "couldn't parse arguments (line %d)", i);
+			ret = -1;
+			break;
+		}
+		
+        dbgx(1, "argc = %d, %s, %s, %s", argc, argv[0], argv[1], argv[2]);
+		/* check first keyword against modules */
+		for (m = mods; *m != NULL; m++) {
+			if (strcasecmp((*m)->name, argv[0]) == 0) {
+                dbgx(1, "comparing %s to %s", argv[0], (*m)->name);
+				break;
+			}
+		}
+		
+		/* do we have a match? */
+		if (*m == NULL) {
+			sprintf(errbuf, "unknown directive '%s' (line %d)", argv[0], i);
+			ret = -1;
+			break;
+		}
+		
+		/* allocate memory for our rule */
+		if ((rule = calloc(1, sizeof(*rule))) == NULL) {
+			sprintf(errbuf, "calloc");
+			ret = -1;
+			break;
+		}
+		rule->mod = *m;
+
+        /* pass the remaining args to the rule */
+		if (rule->mod->open != NULL &&
+		    (rule->data = rule->mod->open(argc, argv)) == NULL) {
+			sprintf(errbuf, "invalid argument to directive '%s' (line %d)",
+			    rule->mod->name, i);
+			ret = -1;
+			break;
+		}
+		/* append the rule to the rule list */
+		TAILQ_INSERT_TAIL(&rules, rule, next);
+	}
+	
+	/* close the file */
+	fclose(fp);
+    dbg(1, "close file...");
+    
+	if (ret == 0) {
+		buf[0] = '\0';
+		TAILQ_FOREACH(rule, &rules, next) {
+			strlcat(buf, rule->mod->name, sizeof(buf));
+			strlcat(buf, " -> ", sizeof(buf));
+		}
+		buf[strlen(buf) - 4] = '\0';
+		sprintf(errbuf, "wtf: %s", buf);
+        // ret = -1;
+	}
+	return (ret);
+}
+
+void
+mod_apply(struct pktq *pktq)
+{
+	struct rule *rule;
+	
+	TAILQ_FOREACH(rule, &rules, next) {
+		rule->mod->apply(rule->data, pktq);
+	}
+}
+
+void
+mod_close(void)
+{
+	struct rule *rule;
+	
+	TAILQ_FOREACH_REVERSE(rule, &rules, next, head) {
+		if (rule->mod->close != NULL)
+			rule->data = rule->mod->close(rule->data);
+		TAILQ_REMOVE(&rules, rule, next);
+		free(rule);
+	}
+}

+ 27 - 0
src/fragroute/mod.h

@@ -0,0 +1,27 @@
+/*
+ * mod.h
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod.h 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#ifndef MOD_H
+#define MOD_H
+
+#include "pkt.h"
+
+struct mod {
+	char	 *name;
+	char	 *usage;
+	void	*(*open)(int argc, char *argv[]);
+	int	 (*apply)(void *data, struct pktq *pktq);
+	void	*(*close)(void *data);
+};
+
+void	mod_usage(void);
+int	mod_open(const char *script, char *errbuf);
+void	mod_apply(struct pktq *pktq);
+void	mod_close(void);
+
+#endif /* MOD_H */

+ 97 - 0
src/fragroute/mod_delay.c

@@ -0,0 +1,97 @@
+/*
+ * mod_delay.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_delay.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pkt.h"
+#include "mod.h"
+
+#define DELAY_FIRST	1
+#define DELAY_LAST	2
+#define DELAY_RANDOM	3
+
+struct delay_data {
+	rand_t		*rnd;
+	int		 which;
+	struct timeval	 tv;
+};
+
+void *
+delay_close(void *d)
+{
+	struct delay_data *data = (struct delay_data *)d;
+	
+	if (data != NULL) {
+		rand_close(data->rnd);
+		free(data);
+	}
+	return (NULL);
+}
+
+void *
+delay_open(int argc, char *argv[])
+{
+	struct delay_data *data;
+	uint64_t usec;
+	
+	if (argc != 3)
+		return (NULL);
+	
+	if ((data = malloc(sizeof(*data))) == NULL)
+		return (NULL);
+
+	data->rnd = rand_open();
+	
+	if (strcasecmp(argv[1], "first") == 0)
+		data->which = DELAY_FIRST;
+	else if (strcasecmp(argv[1], "last") == 0) 
+		data->which = DELAY_LAST;
+	else if (strcasecmp(argv[1], "random") == 0) 
+		data->which = DELAY_RANDOM;
+	else 
+		return (delay_close(data));
+	
+	if ((usec = atoi(argv[2])) <= 0)
+		return (delay_close(data));
+	
+	usec *= 1000;
+	data->tv.tv_sec = usec / 1000000;
+	data->tv.tv_usec = usec % 1000000;
+	
+	return (data);
+}
+
+int
+delay_apply(void *d, struct pktq *pktq)
+{
+	struct delay_data *data = (struct delay_data *)d;
+	struct pkt *pkt;
+	
+	if (data->which == DELAY_FIRST)
+		pkt = TAILQ_FIRST(pktq);
+	else if (data->which == DELAY_LAST)
+		pkt = TAILQ_LAST(pktq, pktq);
+	else 
+		pkt = pktq_random(data->rnd, pktq);
+	
+	memcpy(&pkt->pkt_ts, &data->tv, sizeof(pkt->pkt_ts));
+	
+	return (0);
+}
+
+struct mod mod_delay = {
+	"delay",			/* name */
+	"delay first|last|random <ms>",	/* usage */
+	delay_open,			/* open */
+	delay_apply,			/* apply */
+	delay_close			/* close */
+};

+ 97 - 0
src/fragroute/mod_drop.c

@@ -0,0 +1,97 @@
+/*
+ * mod_drop.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_drop.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pkt.h"
+#include "mod.h"
+
+#define DROP_FIRST	1
+#define DROP_LAST	2
+#define DROP_RANDOM	3
+
+struct drop_data {
+	rand_t	*rnd;
+	int	 which;
+	int	 percent;
+};
+
+void *
+drop_close(void *d)
+{
+	struct drop_data *data = (struct drop_data *)d;
+	
+	if (data != NULL) {
+		rand_close(data->rnd);
+		free(data);
+	}
+	return (NULL);
+}
+
+void *
+drop_open(int argc, char *argv[])
+{
+	struct drop_data *data;
+	
+	if (argc != 3)
+		return (NULL);
+	
+	if ((data = calloc(1, sizeof(*data))) == NULL)
+		return (NULL);
+
+	data->rnd = rand_open();
+	
+	if (strcasecmp(argv[1], "first") == 0)
+		data->which = DROP_FIRST;
+	else if (strcasecmp(argv[1], "last") == 0)
+		data->which = DROP_LAST;
+	else if (strcasecmp(argv[1], "random") == 0)
+		data->which = DROP_RANDOM;
+	else
+		return (drop_close(data));
+	
+	if ((data->percent = atoi(argv[2])) <= 0 || data->percent > 100)
+		return (drop_close(data));
+
+	return (data);
+}
+
+int
+drop_apply(void *d, struct pktq *pktq)
+{
+	struct drop_data *data = (struct drop_data *)d;
+	struct pkt *pkt;
+
+	if (data->percent < 100 &&
+	    (rand_uint16(data->rnd) % 100) > data->percent)
+		return (0);
+	
+	if (data->which == DROP_FIRST)
+		pkt = TAILQ_FIRST(pktq);
+	else if (data->which == DROP_LAST)
+		pkt = TAILQ_LAST(pktq, pktq);
+	else
+		pkt = pktq_random(data->rnd, pktq);
+
+	TAILQ_REMOVE(pktq, pkt, pkt_next);
+	pkt_free(pkt);
+	
+	return (0);
+}
+
+struct mod mod_drop = {
+	"drop",					/* name */
+	"drop first|last|random <prob-%>",	/* usage */
+	drop_open,				/* open */
+	drop_apply,				/* apply */
+	drop_close				/* close */
+};

+ 100 - 0
src/fragroute/mod_dup.c

@@ -0,0 +1,100 @@
+/*
+ * mod_dup.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_dup.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pkt.h"
+#include "mod.h"
+
+#define DUP_FIRST	1
+#define DUP_LAST	2
+#define DUP_RANDOM	3
+
+struct dup_data {
+	rand_t	*rnd;
+	int	 which;
+	int	 percent;
+};
+
+void *
+dup_close(void *d)
+{
+	struct dup_data *data = (struct dup_data *)d;
+	
+	if (data != NULL) {
+		rand_close(data->rnd);
+		free(data);
+	}
+	return (NULL);
+}
+
+void *
+dup_open(int argc, char *argv[])
+{
+	struct dup_data *data;
+	
+	if (argc != 3)
+		return (NULL);
+	
+	if ((data = malloc(sizeof(*data))) == NULL)
+		return (NULL);
+
+	data->rnd = rand_open();
+
+	if (strcasecmp(argv[1], "first") == 0)
+		data->which = DUP_FIRST;
+	else if (strcasecmp(argv[1], "last") == 0)
+		data->which = DUP_LAST;
+	else if (strcasecmp(argv[1], "random") == 0)
+		data->which = DUP_RANDOM;
+	else
+		return (dup_close(data));
+
+	if ((data->percent = atoi(argv[2])) <= 0 || data->percent > 100)
+		return (dup_close(data));
+
+	return (data);
+}
+
+int
+dup_apply(void *d, struct pktq *pktq)
+{
+	struct dup_data *data = (struct dup_data *)d;
+	struct pkt *pkt, *new;
+	
+	if (data->percent < 100 &&
+	    (rand_uint16(data->rnd) % 100) > data->percent)
+		return (0);
+	
+	if ((new = pkt_new()) == NULL)
+		return (-1);
+	
+	if (data->which == DUP_FIRST)
+		pkt = TAILQ_FIRST(pktq);
+	else if (data->which == DUP_LAST)
+		pkt = TAILQ_LAST(pktq, pktq);
+	else
+		pkt = pktq_random(data->rnd, pktq);
+	
+	new = pkt_dup(pkt);
+	TAILQ_INSERT_AFTER(pktq, pkt, new, pkt_next);
+	
+	return (0);
+}
+
+struct mod mod_dup = {
+	"dup",					/* name */
+	"dup first|last|random <prob-%>",	/* usage */
+	dup_open,				/* open */
+	dup_apply,				/* apply */
+	dup_close				/* close */
+};

+ 57 - 0
src/fragroute/mod_echo.c

@@ -0,0 +1,57 @@
+/*
+ * mod_echo.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_echo.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "argv.h"
+#include "mod.h"
+
+void *
+echo_open(int argc, char *argv[])
+{
+	char *p;
+	
+	if (argc < 2)
+		return (NULL);
+
+	if ((p = argv_copy(argv + 1)) == NULL)
+		return (NULL);
+
+	return (p);
+}
+
+int
+echo_apply(void *d, struct pktq *pktq)
+{
+	char *p = (char *)d;
+
+	printf("%s\n", p);
+	return (0);
+}
+
+void *
+echo_close(void *d)
+{
+	if (d != NULL)
+		free(d);
+	return (NULL);
+}
+
+struct mod mod_echo = {
+	"echo",				/* name */
+	"echo <string> ...",		/* usage */
+	echo_open,			/* open */
+	echo_apply,			/* apply */
+	echo_close			/* close */
+};

+ 125 - 0
src/fragroute/mod_ip_chaff.c

@@ -0,0 +1,125 @@
+/*
+ * mod_ip_chaff.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_ip_chaff.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mod.h"
+#include "pkt.h"
+#include "randutil.h"
+
+#define CHAFF_TYPE_DUP	 1
+#define CHAFF_TYPE_OPT	 2
+#define CHAFF_TYPE_TTL	 3
+
+struct ip_chaff_data {
+	rand_t		*rnd;
+	int		 type;
+	int		 ttl;
+	struct pktq	*pktq;
+};
+
+void *
+ip_chaff_close(void *d)
+{
+	struct ip_chaff_data *data = (struct ip_chaff_data *)d;
+	
+	if (data != NULL) {
+		rand_close(data->rnd);
+		free(data);
+	}
+	return (NULL);
+}
+
+void *
+ip_chaff_open(int argc, char *argv[])
+{
+	struct ip_chaff_data *data;
+
+	if (argc < 2)
+		return (NULL);
+	
+	if ((data = calloc(1, sizeof(*data))) == NULL)
+		return (NULL);
+
+	data->rnd = rand_open();
+	
+	if (strcasecmp(argv[1], "dup") == 0) {
+		data->type = CHAFF_TYPE_DUP;
+	} else if (strcasecmp(argv[1], "opt") == 0) {
+		data->type = CHAFF_TYPE_OPT;
+	} else if ((data->ttl = atoi(argv[1])) >= 0 && data->ttl < 256) {
+                data->type = CHAFF_TYPE_TTL;
+	} else
+		return (ip_chaff_close(data));
+
+	return (data);
+}
+
+int
+ip_chaff_apply(void *d, struct pktq *pktq)
+{
+	struct ip_chaff_data *data = (struct ip_chaff_data *)d;
+	struct pkt *pkt, *new, *next;
+	struct ip_opt opt;
+	int i;
+	
+	for (pkt = TAILQ_FIRST(pktq); pkt != TAILQ_END(pktq); pkt = next) {
+		next = TAILQ_NEXT(pkt, pkt_next);
+		
+		if (pkt->pkt_ip_data == NULL)
+			continue;
+		
+		new = pkt_dup(pkt);
+		rand_strset(data->rnd, new->pkt_ip_data,
+		    new->pkt_end - new->pkt_ip_data + 1);
+		
+		switch (data->type) {
+		case CHAFF_TYPE_DUP:
+			new->pkt_ts.tv_usec = 1;
+			ip_checksum(new->pkt_ip, new->pkt_ip_data -
+			    new->pkt_eth_data);
+			break;
+		case CHAFF_TYPE_OPT:
+			opt.opt_type = 0x42;
+			opt.opt_len = IP_OPT_LEN;
+			i = ip_add_option(new->pkt_ip,
+			    PKT_BUF_LEN - ETH_HDR_LEN, IP_PROTO_IP,
+			    &opt, opt.opt_len);
+			/* XXX - whack opt with random crap */
+			*(uint32_t *)new->pkt_ip_data = rand_uint32(data->rnd);
+			new->pkt_ip_data += i;
+			new->pkt_end += i;
+			ip_checksum(new->pkt_ip, new->pkt_ip_data -
+			    new->pkt_eth_data);
+			break;
+		case CHAFF_TYPE_TTL:
+			new->pkt_ip->ip_ttl = data->ttl;
+			ip_checksum(new->pkt_ip, new->pkt_ip_data -
+			    new->pkt_eth_data);
+			break;
+		}
+		/* Minimal random reordering. */
+		if ((pkt->pkt_ip->ip_sum & 1) == 0)
+			TAILQ_INSERT_BEFORE(pkt, new, pkt_next);
+		else
+			TAILQ_INSERT_AFTER(pktq, pkt, new, pkt_next);
+	}
+	return (0);
+}
+
+struct mod mod_ip_chaff = {
+	"ip_chaff",				/* name */
+	"ip_chaff dup|opt|<ttl>",		/* usage */
+	ip_chaff_open,				/* open */
+	ip_chaff_apply,				/* apply */
+	ip_chaff_close				/* close */
+};

+ 171 - 0
src/fragroute/mod_ip_frag.c

@@ -0,0 +1,171 @@
+/*
+ * mod_ip_frag.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_ip_frag.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mod.h"
+#include "pkt.h"
+#include "randutil.h"
+
+#ifndef MAX
+#define MAX(a,b)	(((a)>(b))?(a):(b))
+#endif
+
+#define FAVOR_OLD	1
+#define FAVOR_NEW	2
+
+static struct ip_frag_data {
+	rand_t	*rnd;
+	int	 size;
+	int	 overlap;
+} ip_frag_data;
+
+void *
+ip_frag_close(void *d)
+{
+	if (ip_frag_data.rnd != NULL)
+		rand_close(ip_frag_data.rnd);
+	ip_frag_data.size = 0;
+	return (NULL);
+}
+
+void *
+ip_frag_open(int argc, char *argv[])
+{
+	if (argc < 2) {
+		warnx("need fragment <size> in bytes");
+		return (NULL);
+	}
+	ip_frag_data.rnd = rand_open();
+	ip_frag_data.size = atoi(argv[1]);
+	
+	if (ip_frag_data.size == 0 || (ip_frag_data.size % 8) != 0) {
+		warnx("fragment size must be a multiple of 8");
+		return (ip_frag_close(&ip_frag_data));
+	}
+	if (argc == 3) {
+		if (strcmp(argv[2], "old") == 0 ||
+		    strcmp(argv[2], "win32") == 0)
+			ip_frag_data.overlap = FAVOR_OLD;
+		else if (strcmp(argv[2], "new") == 0 ||
+		    strcmp(argv[2], "unix") == 0)
+			ip_frag_data.overlap = FAVOR_NEW;
+		else
+			return (ip_frag_close(&ip_frag_data));
+	}
+	return (&ip_frag_data);
+}
+
+int
+ip_frag_apply(void *d, struct pktq *pktq)
+{
+	struct pkt *pkt, *new, *next, tmp;
+	int hl, fraglen, off;
+	u_char *p, *p1, *p2;
+
+	for (pkt = TAILQ_FIRST(pktq); pkt != TAILQ_END(pktq); pkt = next) {
+		next = TAILQ_NEXT(pkt, pkt_next);
+		
+		if (pkt->pkt_ip == NULL || pkt->pkt_ip_data == NULL)
+			continue;
+		
+		hl = pkt->pkt_ip->ip_hl << 2;
+	
+		/*
+		 * Preserve transport protocol header in first frag,
+		 * to bypass filters that block `short' fragments.
+		 */
+		switch (pkt->pkt_ip->ip_p) {
+		case IP_PROTO_ICMP:
+			fraglen = MAX(ICMP_LEN_MIN, ip_frag_data.size);
+			break;
+		case IP_PROTO_UDP:
+			fraglen = MAX(UDP_HDR_LEN, ip_frag_data.size);
+			break;
+		case IP_PROTO_TCP:
+			fraglen = MAX(pkt->pkt_tcp->th_off << 2,
+			    ip_frag_data.size);
+			break;
+		default:
+			fraglen = ip_frag_data.size;
+			break;
+		}
+		if (fraglen & 7)
+			fraglen = (fraglen & ~7) + 8;
+		
+		if (pkt->pkt_end - pkt->pkt_ip_data < fraglen)
+			continue;
+		
+		for (p = pkt->pkt_ip_data; p < pkt->pkt_end; ) {
+			new = pkt_new();
+			memcpy(new->pkt_ip, pkt->pkt_ip, hl);
+			new->pkt_ip_data = new->pkt_eth_data + hl;
+			
+			p1 = p, p2 = NULL;
+			off = (p - pkt->pkt_ip_data) >> 3;
+
+			if (ip_frag_data.overlap != 0 && (off & 1) != 0 &&
+			    p + (fraglen << 1) < pkt->pkt_end) {
+				rand_strset(ip_frag_data.rnd, tmp.pkt_buf,
+				    fraglen);
+				if (ip_frag_data.overlap == FAVOR_OLD) {
+					p1 = p + fraglen;
+					p2 = tmp.pkt_buf;
+				} else if (ip_frag_data.overlap == FAVOR_NEW) {
+					p1 = tmp.pkt_buf;
+					p2 = p + fraglen;
+				}
+				new->pkt_ip->ip_off = htons(IP_MF |
+				    (off + (fraglen >> 3)));
+			} else {
+				new->pkt_ip->ip_off = htons(off |
+				    ((p + fraglen < pkt->pkt_end) ? IP_MF: 0));
+			}
+			new->pkt_ip->ip_len = htons(hl + fraglen);
+			ip_checksum(new->pkt_ip, hl + fraglen);
+			
+			memcpy(new->pkt_ip_data, p1, fraglen);
+			new->pkt_end = new->pkt_ip_data + fraglen;
+			TAILQ_INSERT_BEFORE(pkt, new, pkt_next);
+
+			if (p2 != NULL) {
+				new = pkt_dup(new);
+				new->pkt_ts.tv_usec = 1;
+				new->pkt_ip->ip_off = htons(IP_MF | off);
+				new->pkt_ip->ip_len = htons(hl + (fraglen<<1));
+				ip_checksum(new->pkt_ip, hl + (fraglen<<1));
+				
+				memcpy(new->pkt_ip_data, p, fraglen);
+				memcpy(new->pkt_ip_data+fraglen, p2, fraglen);
+				new->pkt_end = new->pkt_ip_data + (fraglen<<1);
+				TAILQ_INSERT_BEFORE(pkt, new, pkt_next);
+				p += (fraglen << 1);
+			} else
+				p += fraglen;
+			
+			if ((fraglen = pkt->pkt_end - p) > ip_frag_data.size)
+				fraglen = ip_frag_data.size;
+		}
+		TAILQ_REMOVE(pktq, pkt, pkt_next);
+		pkt_free(pkt);
+	}
+	return (0);
+}
+
+struct mod mod_ip_frag = {
+	"ip_frag",				/* name */
+	"ip_frag <size> [old|new]",		/* usage */
+	ip_frag_open,				/* open */
+	ip_frag_apply,				/* apply */
+	ip_frag_close				/* close */
+};

+ 91 - 0
src/fragroute/mod_ip_opt.c

@@ -0,0 +1,91 @@
+/*
+ * mod_ip_opt.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_ip_opt.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pkt.h"
+#include "mod.h"
+
+void *
+ip_opt_close(void *d)
+{
+	if (d != NULL)
+		free(d);
+	return (NULL);
+}
+
+void *
+ip_opt_open(int argc, char *argv[])
+{
+	struct ip_opt *opt;
+	struct addr addr;
+	int i, j;
+	
+	if (argc < 4)
+		return (NULL);
+	
+	if ((opt = calloc(1, sizeof(*opt))) == NULL)
+		return (NULL);
+	
+	if (strcasecmp(argv[1], "lsrr") == 0) {
+		opt->opt_type = IP_OPT_LSRR;
+	} else if (strcasecmp(argv[1], "ssrr") == 0) {
+		opt->opt_type = IP_OPT_SSRR;
+	} else
+		return (ip_opt_close(opt));
+	
+	if ((i = atoi(argv[2])) < 4 || i > 0xff) {
+		warnx("<ptr> must be >= 4, and should be a multiple of 4");
+		return (ip_opt_close(opt));
+	}
+	opt->opt_data.rr.ptr = i;
+	
+	for (i = 3, j = 0; i < argc && j < 9; i++, j++) {
+		if (addr_aton(argv[i], &addr) < 0) {
+			return (ip_opt_close(opt));
+		}
+		opt->opt_data.rr.iplist[j] = addr.addr_ip;
+	}
+	opt->opt_len = IP_OPT_LEN + 1 + (IP_ADDR_LEN * j);
+	
+	return (opt);
+}
+
+int
+ip_opt_apply(void *d, struct pktq *pktq)
+{
+	struct ip_opt *opt = (struct ip_opt *)d;
+	struct pkt *pkt;
+	size_t len;
+
+	TAILQ_FOREACH(pkt, pktq, pkt_next) {
+		len = ip_add_option(pkt->pkt_ip, PKT_BUF_LEN - ETH_HDR_LEN,
+		    IP_PROTO_IP, opt, opt->opt_len);
+
+		if (len > 0) {
+			pkt->pkt_end += len;
+			pkt_decorate(pkt);
+			ip_checksum(pkt->pkt_ip,
+			    pkt->pkt_end - pkt->pkt_eth_data);
+		}
+	}
+	return (0);
+}
+
+struct mod mod_ip_opt = {
+	"ip_opt",					/* name */
+	"ip_opt lsrr|ssrr <ptr> <ip-addr> ...",		/* usage */
+	ip_opt_open,					/* open */
+	ip_opt_apply,					/* apply */
+	ip_opt_close					/* close */
+};

+ 69 - 0
src/fragroute/mod_ip_tos.c

@@ -0,0 +1,69 @@
+/*
+ * mod_ip_tos.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_ip_tos.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "argv.h"
+#include "mod.h"
+#include "pkt.h"
+
+struct ip_tos_data {
+	int	tos;
+};
+
+void *
+ip_tos_close(void *d)
+{
+	if (d != NULL)
+		free(d);
+	return (NULL);
+}
+
+void *
+ip_tos_open(int argc, char *argv[])
+{
+	struct ip_tos_data *data;
+
+	if (argc != 2)
+		return (NULL);
+
+	if ((data = calloc(1, sizeof(*data))) == NULL)
+		return (NULL);
+
+	if (sscanf(argv[1], "%i", &data->tos) != 1 ||
+	    data->tos < 0 || data->tos > 255)
+		return (ip_tos_close(data));
+
+	return (data);
+}
+
+int
+ip_tos_apply(void *d, struct pktq *pktq)
+{
+	struct ip_tos_data *data = (struct ip_tos_data *)d;
+	struct pkt *pkt;
+
+	TAILQ_FOREACH(pkt, pktq, pkt_next) {
+		pkt->pkt_ip->ip_tos = data->tos;
+		/* XXX - do incremental checksum */
+		ip_checksum(pkt->pkt_ip, pkt->pkt_ip_data - pkt->pkt_eth_data);
+	}
+	return (0);
+}
+
+struct mod mod_ip_tos = {
+	"ip_tos",			/* name */
+	"ip_tos <tos>",			/* usage */
+	ip_tos_open,			/* open */
+	ip_tos_apply,			/* apply */
+	ip_tos_close			/* close */
+};

+ 73 - 0
src/fragroute/mod_ip_ttl.c

@@ -0,0 +1,73 @@
+/*
+ * mod_ip_ttl.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_ip_ttl.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "argv.h"
+#include "mod.h"
+#include "pkt.h"
+
+struct ip_ttl_data {
+	int	ttl;
+};
+
+void *
+ip_ttl_close(void *d)
+{
+	if (d != NULL)
+		free(d);
+	return (NULL);
+}
+
+void *
+ip_ttl_open(int argc, char *argv[])
+{
+	struct ip_ttl_data *data;
+
+	if (argc != 2)
+		return (NULL);
+
+	if ((data = calloc(1, sizeof(*data))) == NULL)
+		return (NULL);
+	
+	if ((data->ttl = atoi(argv[1])) <= 0 || data->ttl > 255)
+		return (ip_ttl_close(data));
+
+	return (data);
+}
+
+int
+ip_ttl_apply(void *d, struct pktq *pktq)
+{
+	struct ip_ttl_data *data = (struct ip_ttl_data *)d;
+	struct pkt *pkt;
+	int ttldec;
+
+	TAILQ_FOREACH(pkt, pktq, pkt_next) {
+		ttldec = pkt->pkt_ip->ip_ttl - data->ttl;
+		pkt->pkt_ip->ip_ttl = data->ttl;
+		
+		if (pkt->pkt_ip->ip_sum >= htons(0xffff - (ttldec << 8)))
+			pkt->pkt_ip->ip_sum += htons(ttldec << 8) + 1;
+		else
+			pkt->pkt_ip->ip_sum += htons(ttldec << 8);
+	}
+	return (0);
+}
+
+struct mod mod_ip_ttl = {
+	"ip_ttl",			/* name */
+	"ip_ttl <ttl>",			/* usage */
+	ip_ttl_open,			/* open */
+	ip_ttl_apply,			/* apply */
+	ip_ttl_close			/* close */
+};

+ 79 - 0
src/fragroute/mod_order.c

@@ -0,0 +1,79 @@
+/*
+ * mod_order.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_order.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mod.h"
+
+#define ORDER_RANDOM	1
+#define ORDER_REVERSE	2
+
+struct order_data {
+	rand_t	*rnd;
+	int	 type;
+};
+
+void *
+order_close(void *d)
+{
+	struct order_data *data = (struct order_data *)d;
+
+	if (data != NULL) {
+		rand_close(data->rnd);
+		free(data);
+	}
+	return (NULL);
+}
+
+void *
+order_open(int argc, char *argv[])
+{
+	struct order_data *data;
+	
+	if (argc < 2)
+		return (NULL);
+	
+	if ((data = malloc(sizeof(*data))) == NULL)
+		return (NULL);
+
+	data->rnd = rand_open();
+	
+	if (strcasecmp(argv[1], "random") == 0) {
+		data->type = ORDER_RANDOM;
+	} else if (strcasecmp(argv[1], "reverse") == 0) {
+		data->type = ORDER_REVERSE;
+	} else
+		return (order_close(data));
+
+	return (data);
+}
+
+int
+order_apply(void *d, struct pktq *pktq)
+{
+	struct order_data *data = (struct order_data *)d;
+	
+	if (data->type == ORDER_RANDOM)
+		pktq_shuffle(data->rnd, pktq);
+	else
+		pktq_reverse(pktq);
+	
+	return (0);
+}
+
+struct mod mod_order = {
+	"order",			/* name */
+	"order random|reverse",		/* usage */
+	order_open,			/* open */
+	order_apply,			/* apply */
+	order_close			/* close */
+};

+ 326 - 0
src/fragroute/mod_print.c

@@ -0,0 +1,326 @@
+/*
+ * mod_print.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_print.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mod.h"
+#include "pkt.h"
+
+#define EXTRACT_16BITS(p)	((uint16_t)ntohs(*(uint16_t *)(p)))
+#define EXTRACT_32BITS(p)	((uint32_t)ntohl(*(uint32_t *)(p)))
+
+/* XXX - _print_* routines adapted from tcpdump */
+
+static void
+_print_icmp(u_char *p, int length)
+{
+	struct ip_hdr *ip;
+	struct icmp_hdr *icmp;
+	
+	ip = (struct ip_hdr *)p;
+	icmp = (struct icmp_hdr *)(p + (ip->ip_hl * 4));
+
+	/* XXX - truncation? */
+	printf("%s > %s:", ip_ntoa(&ip->ip_src), ip_ntoa(&ip->ip_dst));
+	printf(" icmp: type %d code %d", icmp->icmp_type, icmp->icmp_code);
+}
+
+void
+_print_tcp(unsigned char *p, int length)
+{
+	struct ip_hdr *ip;
+	struct tcp_hdr *tcp;
+	u_short sport, dport, win, urp;
+	u_long seq, ack;
+	int len, tcp_hl;
+	register char ch;
+	
+	ip = (struct ip_hdr *)p;
+	tcp = (struct tcp_hdr *)(p + (ip->ip_hl * 4));
+	len = length - (ip->ip_hl * 4);
+	
+	if (len < TCP_HDR_LEN) {
+		printf("truncated-tcp %d", len);
+		return;
+	}
+	sport = ntohs(tcp->th_sport);
+	dport = ntohs(tcp->th_dport);
+	seq = ntohl(tcp->th_seq);
+	ack = ntohl(tcp->th_ack);
+	win = ntohs(tcp->th_win);
+	urp = ntohs(tcp->th_urp);
+	tcp_hl = tcp->th_off * 4;
+	
+	printf("%s.%d > %s.%d: ", ip_ntoa(&ip->ip_src), sport,
+	    ip_ntoa(&ip->ip_dst), dport);
+	
+	if (tcp->th_flags & (TH_SYN|TH_FIN|TH_RST|TH_PUSH)) {
+		if (tcp->th_flags & TH_SYN)	putchar('S');
+		if (tcp->th_flags & TH_FIN)	putchar('F');
+		if (tcp->th_flags & TH_RST)	putchar('R');
+		if (tcp->th_flags & TH_PUSH)	putchar('P');
+	} else
+		putchar('.');
+	
+	if (tcp_hl > len) {
+		printf(" [bad hdr length]");
+		return;
+	}
+	len -= tcp_hl;
+	
+	if (len > 0 || tcp->th_flags & (TH_SYN | TH_FIN | TH_RST))
+		printf(" %lu:%lu(%d)", seq, seq + len, len);
+	
+	if (tcp->th_flags & TH_ACK)
+		printf(" ack %lu", ack);
+	printf(" win %d", win);
+	if (tcp->th_flags & TH_URG)
+		printf(" urg %d", urp);
+	
+	/* Handle options. */
+	if ((tcp_hl -= TCP_HDR_LEN) > 0) {
+		register const u_char *cp;
+		register int i, opt, len, datalen;
+		
+		cp = (const u_char *)tcp + TCP_HDR_LEN;
+		putchar(' ');
+		ch = '<';
+		
+		while (tcp_hl > 0) {
+			putchar(ch);
+			opt = *cp++;
+			if (TCP_OPT_TYPEONLY(opt)) {
+				len = 1;
+			} else {
+				len = *cp++;    /* total including type, len */
+				if (len < 2 || len > tcp_hl)
+					goto bad;
+				--tcp_hl;         /* account for length byte */
+			}
+			--tcp_hl;           /* account for type byte */
+			datalen = 0;
+			
+/* Bail if "l" bytes of data are not left or were not captured  */
+#define LENCHECK(l) { if ((l) > tcp_hl) goto bad; }
+			
+			switch (opt) {
+			case TCP_OPT_MSS:
+				printf("mss");
+				datalen = 2;
+				LENCHECK(datalen);
+				printf(" %u", EXTRACT_16BITS(cp));
+				break;
+			case TCP_OPT_EOL:
+				printf("eol");
+				break;
+			case TCP_OPT_NOP:
+				printf("nop");
+				break;
+			case TCP_OPT_WSCALE:
+				printf("wscale");
+				datalen = 1;
+				LENCHECK(datalen);
+				printf(" %u", *cp);
+				break;
+			case TCP_OPT_SACKOK:
+				printf("sackOK");
+				if (len != 2)
+					printf("[len %d]", len);
+				break;
+			case TCP_OPT_SACK:
+				datalen = len - 2;
+				if ((datalen % 8) != 0 ||
+				    !(tcp->th_flags & TH_ACK)) {
+					printf("malformed sack ");
+					printf("[len %d] ", datalen);
+					break;
+				}
+				printf("sack %d ", datalen / 8);
+				break;
+			case TCP_OPT_ECHO:
+				printf("echo");
+				datalen = 4;
+				LENCHECK(datalen);
+				printf(" %u", EXTRACT_32BITS(cp));
+				break;
+			case TCP_OPT_ECHOREPLY:
+				printf("echoreply");
+				datalen = 4;
+				LENCHECK(datalen);
+				printf(" %u", EXTRACT_32BITS(cp));
+				break;
+			case TCP_OPT_TIMESTAMP:
+				printf("timestamp");
+				datalen = 8;
+				LENCHECK(4);
+				printf(" %u", EXTRACT_32BITS(cp));
+				LENCHECK(datalen);
+				printf(" %u", EXTRACT_32BITS(cp + 4));
+				break;
+			case TCP_OPT_CC:
+				printf("cc");
+				datalen = 4;
+				LENCHECK(datalen);
+				printf(" %u", EXTRACT_32BITS(cp));
+				break;
+			case TCP_OPT_CCNEW:
+				printf("ccnew");
+				datalen = 4;
+				LENCHECK(datalen);
+				printf(" %u", EXTRACT_32BITS(cp));
+				break;
+			case TCP_OPT_CCECHO:
+				printf("ccecho");
+				datalen = 4;
+				LENCHECK(datalen);
+				printf(" %u", EXTRACT_32BITS(cp));
+				break;
+			default:
+				printf("opt-%d:", opt);
+				datalen = len - 2;
+				for (i = 0; i < datalen; ++i) {
+					LENCHECK(i);
+					printf("%02x", cp[i]);
+				}
+				break;
+			}
+			/* Account for data printed */
+			cp += datalen;
+			tcp_hl -= datalen;
+			
+			/* Check specification against observed length */
+			++datalen;                /* option octet */
+			if (!TCP_OPT_TYPEONLY(opt))
+				++datalen;              /* size octet */
+			if (datalen != len)
+				printf("[len %d]", len);
+			ch = ',';
+			if (opt == TCP_OPT_EOL)
+				break;
+		}
+		putchar('>');
+	}
+	return;
+ bad:
+	fputs("[bad opt]", stdout);
+	if (ch != '\0')
+		putchar('>');
+	return;
+}
+
+static void
+_print_udp(u_char *p, int length)
+{
+	struct ip_hdr *ip;
+	struct udp_hdr *udp;
+	
+	ip = (struct ip_hdr *)p;
+	udp = (struct udp_hdr *)(p + (ip->ip_hl * 4));
+
+	/* XXX - truncation? */
+	printf("%s.%d > %s.%d:", ip_ntoa(&ip->ip_src), ntohs(udp->uh_sport),
+	    ip_ntoa(&ip->ip_dst), ntohs(udp->uh_dport));
+	
+	printf(" udp %d", ntohs(udp->uh_ulen) - UDP_HDR_LEN);
+}
+
+static void
+_print_ip(u_char *p, int length)
+{
+	struct ip_hdr *ip;
+	u_int ip_off, ip_hl, ip_len;
+	
+	ip = (struct ip_hdr *)p;
+	
+	if (length < IP_HDR_LEN) {
+		printf("truncated-ip %d", length);
+		return;
+	}
+	ip_hl = ip->ip_hl * 4;
+	ip_len = ntohs(ip->ip_len);
+	
+	if (length < ip_len) {
+		printf("truncated-ip - %d bytes missing!", ip_len - length);
+		return;
+	}
+	ip_off = ntohs(ip->ip_off);
+	
+	/* Handle first fragment. */
+	if ((ip_off & IP_OFFMASK) == 0) {
+		switch (ip->ip_p) {
+		case IP_PROTO_TCP:
+			_print_tcp(p, ip_len);
+			break;
+		case IP_PROTO_UDP:
+			_print_udp(p, ip_len);
+			break;
+		case IP_PROTO_ICMP:
+			_print_icmp(p, ip_len);
+			break;
+		default:
+			printf("%s > %s:", ip_ntoa(&ip->ip_src),
+			    ip_ntoa(&ip->ip_dst));
+			printf(" ip-proto-%d %d", ip->ip_p, ip_len);
+			break;
+		}
+	}
+	/* Handle more frags. */
+	if (ip_off & (IP_MF|IP_OFFMASK)) {
+		if (ip_off & IP_OFFMASK)
+			printf("%s > %s:", ip_ntoa(&ip->ip_src),
+			    ip_ntoa(&ip->ip_dst));
+		printf(" (frag %d:%d@%d%s)", ntohs(ip->ip_id), ip_len - ip_hl,
+		    (ip_off & IP_OFFMASK) << 3, (ip_off & IP_MF) ? "+" : "");
+	} else if (ip_off & IP_DF)
+		printf(" (DF)");
+	
+	if (ip->ip_tos)
+		printf(" [tos 0x%x]", ip->ip_tos);
+	if (ip->ip_ttl <= 1)
+		printf(" [ttl %d]", ip->ip_ttl);
+}
+
+static char *
+timerntoa(struct timeval *tv)
+{
+	static char buf[128];
+	uint64_t usec;
+
+	usec = (tv->tv_sec * 1000000) + tv->tv_usec;
+	
+	snprintf(buf, sizeof(buf), "%d.%03d ms",
+	    (int)(usec / 1000), (int)(usec % 1000));
+	
+	return (buf);
+}
+
+int
+print_apply(void *d, struct pktq *pktq)
+{
+	struct pkt *pkt;
+
+	TAILQ_FOREACH(pkt, pktq, pkt_next) {
+		_print_ip(pkt->pkt_eth_data, pkt->pkt_end - pkt->pkt_eth_data);
+		if (timerisset(&pkt->pkt_ts))
+			printf(" [delay %s]", timerntoa(&pkt->pkt_ts));
+		printf("\n");
+	}
+	return (0);
+}
+
+struct mod mod_print = {
+	"print",		/* name */
+	"print",		/* usage */
+	NULL,			/* init */
+	print_apply,		/* apply */
+	NULL			/* close */
+};

+ 177 - 0
src/fragroute/mod_tcp_chaff.c

@@ -0,0 +1,177 @@
+/*
+ * mod_tcp_chaff.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_tcp_chaff.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pkt.h"
+#include "mod.h"
+#include "randutil.h"
+
+#define CHAFF_TYPE_CKSUM	1
+#define CHAFF_TYPE_NULL		2
+#define CHAFF_TYPE_PAWS		3
+#define CHAFF_TYPE_REXMIT	4
+#define CHAFF_TYPE_SEQ		5
+#define CHAFF_TYPE_SYN		6
+#define CHAFF_TYPE_TTL		7
+
+struct tcp_chaff_data {
+	rand_t		*rnd;
+	int		 type;
+	int		 ttl;
+};
+
+void *
+tcp_chaff_close(void *d)
+{
+	struct tcp_chaff_data *data = (struct tcp_chaff_data *)d;
+	
+	if (data != NULL) {
+		rand_close(data->rnd);
+		free(data);
+	}
+	return (NULL);
+}
+
+void *
+tcp_chaff_open(int argc, char *argv[])
+{
+	struct tcp_chaff_data *data;
+	
+	if (argc < 2)
+		return (NULL);
+	
+	if ((data = calloc(1, sizeof(*data))) == NULL)
+		return (NULL);
+
+	data->rnd = rand_open();
+	
+	if (strcasecmp(argv[1], "cksum") == 0)
+		data->type = CHAFF_TYPE_CKSUM;
+	else if (strcasecmp(argv[1], "null") == 0)
+		data->type = CHAFF_TYPE_NULL;
+	else if (strcasecmp(argv[1], "paws") == 0)
+		data->type = CHAFF_TYPE_PAWS;
+	else if (strcasecmp(argv[1], "rexmit") == 0)
+		data->type = CHAFF_TYPE_REXMIT;
+	else if (strcasecmp(argv[1], "seq") == 0)
+		data->type = CHAFF_TYPE_SEQ;
+	else if (strcasecmp(argv[1], "syn") == 0)
+		data->type = CHAFF_TYPE_SYN;
+	else if ((data->ttl = atoi(argv[1])) > 0 && data->ttl < 256)
+		data->type = CHAFF_TYPE_TTL;
+	else
+		return (tcp_chaff_close(data));
+	
+	return (data);
+}
+
+int
+tcp_chaff_apply(void *d, struct pktq *pktq)
+{
+	struct tcp_chaff_data *data = (struct tcp_chaff_data *)d;
+	struct pkt *pkt, *new, *next;
+	struct tcp_opt opt;
+	int i;
+	
+	for (pkt = TAILQ_FIRST(pktq); pkt != TAILQ_END(pktq); pkt = next) {
+		next = TAILQ_NEXT(pkt, pkt_next);
+		
+		if (pkt->pkt_ip == NULL || pkt->pkt_ip->ip_p != IP_PROTO_TCP ||
+		    pkt->pkt_tcp == NULL || pkt->pkt_tcp_data == NULL ||
+		    (pkt->pkt_tcp->th_flags & TH_ACK) == 0)
+			continue;
+		
+		new = pkt_dup(pkt);
+		rand_strset(data->rnd, new->pkt_tcp_data, new->pkt_end -
+		    new->pkt_tcp_data + 1);
+	
+		switch (data->type) {
+		case CHAFF_TYPE_CKSUM:
+			ip_checksum(new->pkt_ip,
+			    new->pkt_ip_data - new->pkt_eth_data);
+			new->pkt_tcp->th_sum = rand_uint16(data->rnd);
+			break;
+		case CHAFF_TYPE_NULL:
+			new->pkt_tcp->th_flags = 0;
+			ip_checksum(new->pkt_ip, new->pkt_end -
+			    new->pkt_eth_data);
+			break;
+		case CHAFF_TYPE_PAWS:
+			/* Delete any existing TCP options. */
+			i = (new->pkt_tcp->th_off << 2) - TCP_HDR_LEN;
+			new->pkt_tcp->th_off = 5;
+			new->pkt_end -= i;
+			new->pkt_ip->ip_len = htons(new->pkt_end -
+			    new->pkt_eth_data);
+			
+			/* Insert initial timestamp, for PAWS elimination. */
+			opt.opt_type = TCP_OPT_TIMESTAMP;
+			opt.opt_len = TCP_OPT_LEN + 8;
+			opt.opt_data.timestamp[0] = 0;
+			opt.opt_data.timestamp[1] = 0;
+			if ((i = ip_add_option(new->pkt_ip,
+			    PKT_BUF_LEN - ETH_HDR_LEN,
+			    IP_PROTO_TCP, &opt, opt.opt_len)) < 0) {
+				pkt_free(new);
+				continue;
+			}
+			new->pkt_end += i;
+			ip_checksum(new->pkt_ip, new->pkt_end -
+			    new->pkt_eth_data);
+			pkt_decorate(new);
+			break;
+		case CHAFF_TYPE_REXMIT:
+			new->pkt_ts.tv_usec = 1;
+			ip_checksum(new->pkt_ip, new->pkt_end -
+			    new->pkt_eth_data);
+			break;
+		case CHAFF_TYPE_SEQ:
+			/* XXX - dunno recv window? */
+			new->pkt_tcp->th_seq = htonl(666);
+			new->pkt_tcp->th_ack = htonl(666);
+			ip_checksum(new->pkt_ip, new->pkt_end -
+			    new->pkt_eth_data);
+			break;
+		case CHAFF_TYPE_SYN:
+			new->pkt_tcp->th_flags = TH_SYN;
+			new->pkt_tcp->th_seq = rand_uint32(data->rnd);
+			new->pkt_tcp->th_ack = 0;
+			new->pkt_end = new->pkt_tcp_data;
+			new->pkt_tcp_data = NULL;
+			new->pkt_ip->ip_len = htons(new->pkt_end -
+			    new->pkt_eth_data);
+			ip_checksum(new->pkt_ip, new->pkt_end -
+			    new->pkt_eth_data);
+			break;
+		case CHAFF_TYPE_TTL:
+			new->pkt_ip->ip_ttl = data->ttl;
+			ip_checksum(new->pkt_ip, new->pkt_end -
+			    new->pkt_eth_data);
+			break;
+		}
+		/* Minimal random reordering. */
+		if ((new->pkt_tcp->th_sum & 1) == 0)
+			TAILQ_INSERT_BEFORE(pkt, new, pkt_next);
+		else
+			TAILQ_INSERT_AFTER(pktq, pkt, new, pkt_next);
+	}
+	return (0);
+}
+
+struct mod mod_tcp_chaff = {
+	"tcp_chaff",						/* name */
+	"tcp_chaff cksum|null|paws|rexmit|seq|syn|<ttl>",	/* usage */
+	tcp_chaff_open,						/* open */
+	tcp_chaff_apply,					/* apply */
+	tcp_chaff_close						/* close */
+};

+ 91 - 0
src/fragroute/mod_tcp_opt.c

@@ -0,0 +1,91 @@
+/*
+ * mod_tcp_opt.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_tcp_opt.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pkt.h"
+#include "mod.h"
+
+void *
+tcp_opt_close(void *d)
+{
+	if (d != NULL)
+		free(d);
+	return (NULL);
+}
+
+void *
+tcp_opt_open(int argc, char *argv[])
+{
+	struct tcp_opt *opt;
+	int i;
+	
+	if (argc < 3)
+		return (NULL);
+	
+	if ((opt = calloc(1, sizeof(*opt))) == NULL)
+		return (NULL);
+	
+	if (strcasecmp(argv[1], "mss") == 0) {
+		opt->opt_type = TCP_OPT_MSS;
+		opt->opt_len = TCP_OPT_LEN + 2;
+
+		if ((i = atoi(argv[2])) <= 0 || i > 0xffff) {
+			warnx("mss <size> must be from 0-65535");
+			return (tcp_opt_close(opt));
+		}
+		opt->opt_data.mss = htons(i);
+	} else if (strcasecmp(argv[1], "wscale") == 0) {
+		opt->opt_type = TCP_OPT_WSCALE;
+		opt->opt_len = TCP_OPT_LEN + 2;
+		
+		if ((i = atoi(argv[2])) <= 0 || i > 0xff) {
+			warnx("wscale <size> must be from 0-255");
+			return (tcp_opt_close(opt));
+		}
+		opt->opt_data.wscale = i;
+	} else
+		return (tcp_opt_close(opt));
+	
+	return (opt);
+}
+
+int
+tcp_opt_apply(void *d, struct pktq *pktq)
+{
+	struct tcp_opt *opt = (struct tcp_opt *)d;
+	struct pkt *pkt;
+	size_t len;
+
+	TAILQ_FOREACH(pkt, pktq, pkt_next) {
+		len = ip_add_option(pkt->pkt_ip,
+		    sizeof(pkt->pkt_data) - ETH_HDR_LEN,
+		    IP_PROTO_TCP, opt, opt->opt_len);
+
+		if (len > 0) {
+			pkt->pkt_end += len;
+			pkt_decorate(pkt);
+			ip_checksum(pkt->pkt_ip, pkt->pkt_end -
+			    pkt->pkt_eth_data);
+		}
+	}
+	return (0);
+}
+
+struct mod mod_tcp_opt = {
+	"tcp_opt",					/* name */
+	"tcp_opt mss|wscale <size>",			/* usage */
+	tcp_opt_open,					/* open */
+	tcp_opt_apply,					/* apply */
+	tcp_opt_close					/* close */
+};

+ 150 - 0
src/fragroute/mod_tcp_seg.c

@@ -0,0 +1,150 @@
+/*
+ * mod_tcp_seg.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: mod_tcp_seg.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mod.h"
+#include "pkt.h"
+#include "randutil.h"
+
+#ifndef MIN
+#define MIN(a,b)	(((a)<(b))?(a):(b))
+#endif
+
+#define FAVOR_OLD	1
+#define FAVOR_NEW	2
+
+static struct tcp_seg_data {
+	rand_t	*rnd;
+	int	 size;
+	int	 overlap;
+} tcp_seg_data;
+
+void *
+tcp_seg_close(void *d)
+{
+	if (tcp_seg_data.rnd != NULL)
+		rand_close(tcp_seg_data.rnd);
+	tcp_seg_data.size = 0;
+	return (NULL);
+}
+
+void *
+tcp_seg_open(int argc, char *argv[])
+{
+	if (argc < 2) {
+		warnx("need segment <size> in bytes");
+		return (NULL);
+	}
+	tcp_seg_data.rnd = rand_open();
+	
+	if ((tcp_seg_data.size = atoi(argv[1])) == 0) {
+		warnx("invalid segment size '%s'", argv[1]);
+		return (tcp_seg_close(&tcp_seg_data));
+	}
+	if (argc == 3) {
+		if (strcmp(argv[2], "old") == 0 ||
+		    strcmp(argv[2], "win32") == 0)
+			tcp_seg_data.overlap = FAVOR_OLD;
+		else if (strcmp(argv[2], "new") == 0 ||
+		    strcmp(argv[2], "unix") == 0)
+			tcp_seg_data.overlap = FAVOR_NEW;
+		else
+			return (tcp_seg_close(&tcp_seg_data));
+	}
+	return (&tcp_seg_data);
+}
+
+int
+tcp_seg_apply(void *d, struct pktq *pktq)
+{
+	struct pkt *pkt, *new, *next, tmp;
+	uint32_t seq;
+	int hl, tl, len;	
+	u_char *p, *p1, *p2;
+
+	for (pkt = TAILQ_FIRST(pktq); pkt != TAILQ_END(pktq); pkt = next) {
+		next = TAILQ_NEXT(pkt, pkt_next);
+		
+		if (pkt->pkt_ip == NULL || pkt->pkt_ip->ip_p != IP_PROTO_TCP ||
+		    pkt->pkt_tcp == NULL || pkt->pkt_tcp_data == NULL ||
+		    (pkt->pkt_tcp->th_flags & TH_ACK) == 0 ||
+		    pkt->pkt_end - pkt->pkt_tcp_data <= tcp_seg_data.size)
+			continue;
+		
+		hl = pkt->pkt_ip->ip_hl << 2;
+		tl = pkt->pkt_tcp->th_off << 2;
+		seq = ntohl(pkt->pkt_tcp->th_seq);
+	
+		for (p = pkt->pkt_tcp_data; p < pkt->pkt_end; p += len) {
+			new = pkt_new();
+			p1 = p, p2 = NULL;
+			len = MIN(pkt->pkt_end - p, tcp_seg_data.size);
+		
+			if (tcp_seg_data.overlap != 0 &&
+			    p + (len << 1) < pkt->pkt_end) {
+				rand_strset(tcp_seg_data.rnd, tmp.pkt_buf,len);
+				
+				if (tcp_seg_data.overlap == FAVOR_OLD) {
+					p1 = p + len;
+					p2 = tmp.pkt_buf;
+				} else if (tcp_seg_data.overlap == FAVOR_NEW) {
+					p1 = tmp.pkt_buf;
+					p2 = p + len;
+				}
+				len = tcp_seg_data.size;
+				seq += tcp_seg_data.size;
+			}
+			memcpy(new->pkt_ip, pkt->pkt_ip, hl + tl);
+			new->pkt_ip_data = new->pkt_eth_data + hl;
+			new->pkt_tcp_data = new->pkt_ip_data + tl;
+			memcpy(new->pkt_tcp_data, p1, len);
+			new->pkt_end = new->pkt_tcp_data + len;
+			
+			new->pkt_ip->ip_id = rand_uint16(tcp_seg_data.rnd);
+			new->pkt_ip->ip_len = htons(hl + tl + len);
+			new->pkt_tcp->th_seq = htonl(seq);
+			ip_checksum(new->pkt_ip, hl + tl + len);
+			TAILQ_INSERT_BEFORE(pkt, new, pkt_next);
+			
+			if (p2 != NULL) {
+				new = pkt_dup(new);
+				new->pkt_ts.tv_usec = 1;
+				new->pkt_ip->ip_id =
+				    rand_uint16(tcp_seg_data.rnd);
+				new->pkt_ip->ip_len = htons(hl + tl +
+				    (len << 1));
+				new->pkt_tcp->th_seq = htonl(seq - len);
+				
+				memcpy(new->pkt_tcp_data, p, len);
+				memcpy(new->pkt_tcp_data + len, p2, len);
+				new->pkt_end = new->pkt_tcp_data + (len << 1);
+				ip_checksum(new->pkt_ip, hl + tl + (len << 1));
+				TAILQ_INSERT_BEFORE(pkt, new, pkt_next);
+				p += len;
+			}
+			seq += len;
+		}
+		TAILQ_REMOVE(pktq, pkt, pkt_next);
+		pkt_free(pkt);
+	}
+	return (0);
+}
+
+struct mod mod_tcp_seg = {
+	"tcp_seg",				/* name */
+	"tcp_seg <size> [old|new]",		/* usage */
+	tcp_seg_open,				/* open */
+	tcp_seg_apply,				/* apply */
+	tcp_seg_close				/* close */
+};

+ 280 - 0
src/fragroute/pkt.c

@@ -0,0 +1,280 @@
+/*
+ * pkt.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: pkt.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "bget.h"
+#include "pkt.h"
+
+void
+pkt_init(int size)
+{
+	bectl(NULL, malloc, free, sizeof(struct pkt) * size);
+}
+
+struct pkt *
+pkt_new(void)
+{
+	struct pkt *pkt;
+	
+	if ((pkt = bget(sizeof(*pkt))) == NULL)
+		return (NULL);
+	
+	timerclear(&pkt->pkt_ts);
+    // memset(&pkt->pkt_ev, 0, sizeof(pkt->pkt_ev));
+
+	pkt->pkt_data = pkt->pkt_buf + PKT_BUF_ALIGN;
+	pkt->pkt_eth = (struct eth_hdr *)pkt->pkt_data;
+	pkt->pkt_eth_data = pkt->pkt_data + ETH_HDR_LEN;
+	pkt->pkt_ip_data = pkt->pkt_data + ETH_HDR_LEN + IP_HDR_LEN;
+	pkt->pkt_tcp_data = NULL;
+	pkt->pkt_end = pkt->pkt_ip_data;
+	
+	return (pkt);
+}
+
+struct pkt *
+pkt_dup(struct pkt *pkt)
+{
+	struct pkt *new;
+	off_t off;
+	
+	if ((new = bget(sizeof(*new))) == NULL)
+		return (NULL);
+	
+	off = new->pkt_buf - pkt->pkt_buf;
+	
+	new->pkt_ts = pkt->pkt_ts;
+    // memset(&new->pkt_ev, 0, sizeof(new->pkt_ev));
+
+	new->pkt_data = pkt->pkt_data + off;
+	
+	new->pkt_eth = (pkt->pkt_eth != NULL) ?
+	    (struct eth_hdr *)new->pkt_data : NULL;
+	
+	new->pkt_eth_data = (pkt->pkt_eth_data != NULL) ?
+	    pkt->pkt_eth_data + off : NULL;
+	
+	new->pkt_ip_data = (pkt->pkt_ip_data != NULL) ?
+	    pkt->pkt_ip_data + off : NULL;
+	
+	new->pkt_tcp_data = (pkt->pkt_tcp_data != NULL) ?
+	    pkt->pkt_tcp_data + off : NULL;
+	
+	memcpy(new->pkt_data, pkt->pkt_data, pkt->pkt_end - pkt->pkt_data);
+	
+	new->pkt_end = pkt->pkt_end + off;
+	
+	return (new);
+}
+
+void
+pkt_decorate(struct pkt *pkt)
+{
+	u_char *p;
+	int hl, len, off;
+
+	pkt->pkt_data = pkt->pkt_buf + PKT_BUF_ALIGN;
+	pkt->pkt_eth = NULL;
+	pkt->pkt_ip = NULL;
+	pkt->pkt_ip_data = NULL;
+	pkt->pkt_tcp_data = NULL;
+
+	p = pkt->pkt_data;
+	
+	if (p + ETH_HDR_LEN > pkt->pkt_end)
+		return;
+
+	pkt->pkt_eth = (struct eth_hdr *)p;
+	p += ETH_HDR_LEN;
+
+	if (p + IP_HDR_LEN > pkt->pkt_end)
+		return;
+	
+	pkt->pkt_eth_data = p;
+	
+	/* If IP header length is longer than packet length, stop. */
+	hl = pkt->pkt_ip->ip_hl << 2;
+	if (p + hl > pkt->pkt_end) {
+		pkt->pkt_ip = NULL;
+		return;
+	}
+	/* If IP length is longer than packet length, stop. */
+	len = ntohs(pkt->pkt_ip->ip_len);
+	if (p + len > pkt->pkt_end)
+		return;
+
+	/* If IP fragment, stop. */
+	off = ntohs(pkt->pkt_ip->ip_off);
+	if ((off & IP_OFFMASK) != 0 || (off & IP_MF) != 0)
+		return;
+	
+	pkt->pkt_end = p + len;
+	p += hl;
+
+	/* If transport layer header is longer than packet length, stop. */
+	switch (pkt->pkt_ip->ip_p) {
+	case IP_PROTO_ICMP:
+		hl = ICMP_HDR_LEN;
+		break;
+	case IP_PROTO_TCP:
+		if (p + TCP_HDR_LEN > pkt->pkt_end)
+			return;
+		hl = ((struct tcp_hdr *)p)->th_off << 2;
+		break;
+	case IP_PROTO_UDP:
+		hl = UDP_HDR_LEN;
+		break;
+	default:
+		return;
+	}
+	if (p + hl > pkt->pkt_end)
+		return;
+	
+	pkt->pkt_ip_data = p;
+	p += hl;
+
+	/* Check for transport layer data. */
+	switch (pkt->pkt_ip->ip_p) {
+	case IP_PROTO_ICMP:
+		pkt->pkt_icmp_msg = (union icmp_msg *)p;
+		
+		switch (pkt->pkt_icmp->icmp_type) {
+		case ICMP_ECHO:
+		case ICMP_ECHOREPLY:
+			hl = sizeof(pkt->pkt_icmp_msg->echo);
+			break;
+		case ICMP_UNREACH:
+			if (pkt->pkt_icmp->icmp_code == ICMP_UNREACH_NEEDFRAG)
+				hl = sizeof(pkt->pkt_icmp_msg->needfrag);
+			else
+				hl = sizeof(pkt->pkt_icmp_msg->unreach);
+			break;
+		case ICMP_SRCQUENCH:
+		case ICMP_REDIRECT:
+		case ICMP_TIMEXCEED:
+		case ICMP_PARAMPROB:
+			hl = sizeof(pkt->pkt_icmp_msg->srcquench);
+			break;
+		case ICMP_RTRADVERT:
+			hl = sizeof(pkt->pkt_icmp_msg->rtradvert);
+			break;
+		case ICMP_RTRSOLICIT:
+			hl = sizeof(pkt->pkt_icmp_msg->rtrsolicit);
+			break;
+		case ICMP_TSTAMP:
+		case ICMP_TSTAMPREPLY:
+			hl = sizeof(pkt->pkt_icmp_msg->tstamp);
+			break;
+		case ICMP_INFO:
+		case ICMP_INFOREPLY:
+		case ICMP_DNS:
+			hl = sizeof(pkt->pkt_icmp_msg->info);
+			break;
+		case ICMP_MASK:
+		case ICMP_MASKREPLY:
+			hl = sizeof(pkt->pkt_icmp_msg->mask);
+			break;
+		case ICMP_DNSREPLY:
+			hl = sizeof(pkt->pkt_icmp_msg->dnsreply);
+			break;
+		default:
+			hl = pkt->pkt_end - p + 1;
+			break;
+		}
+		if (p + hl > pkt->pkt_end)
+			pkt->pkt_icmp_msg = NULL;
+		break;
+	case IP_PROTO_TCP:
+		if (p < pkt->pkt_end)
+			pkt->pkt_tcp_data = p;
+		break;
+	case IP_PROTO_UDP:
+		if (pkt->pkt_ip_data + ntohs(pkt->pkt_udp->uh_ulen) <=
+		    pkt->pkt_end)
+			pkt->pkt_udp_data = p;
+		break;
+	}
+}
+
+void
+pkt_free(struct pkt *pkt)
+{
+	brel(pkt);
+}
+
+void
+pktq_reverse(struct pktq *pktq)
+{
+	struct pktq tmpq;
+	struct pkt *pkt, *next;
+
+	TAILQ_INIT(&tmpq);
+	for (pkt = TAILQ_FIRST(pktq); pkt != TAILQ_END(pktq); pkt = next) {
+		next = TAILQ_NEXT(pkt, pkt_next);
+		TAILQ_INSERT_HEAD(&tmpq, pkt, pkt_next);
+	}
+	*pktq = tmpq;
+}
+
+void
+pktq_shuffle(rand_t *r, struct pktq *pktq)
+{
+	static struct pkt **pvbase;
+	static int pvlen;
+	struct pkt *pkt;
+	int i;
+
+	i = 0;
+	TAILQ_FOREACH(pkt, pktq, pkt_next) {
+		i++;
+	}
+	if (i > pvlen) {
+		pvlen = i;
+		if (pvbase == NULL)
+			pvbase = malloc(sizeof(pkt) * pvlen);
+		else
+			pvbase = realloc(pvbase, sizeof(pkt) * pvlen);
+	}
+	i = 0;
+	TAILQ_FOREACH(pkt, pktq, pkt_next) {
+		pvbase[i++] = pkt;
+	}
+	TAILQ_INIT(pktq);
+	
+	rand_shuffle(r, pvbase, i, sizeof(pkt));
+
+	while (--i >= 0) {
+		TAILQ_INSERT_TAIL(pktq, pvbase[i], pkt_next);
+	}
+}
+
+struct pkt *
+pktq_random(rand_t *r, struct pktq *pktq)
+{
+	struct pkt *pkt;
+	int i;
+	
+	i = 0;
+	TAILQ_FOREACH(pkt, pktq, pkt_next) {
+		i++;
+	}
+	i = rand_uint32(r) % (i - 1);
+	pkt = TAILQ_FIRST(pktq);
+	
+	while (--i >= 0) {
+		pkt = TAILQ_NEXT(pkt, pkt_next);
+	}
+	return (pkt);
+}

+ 79 - 0
src/fragroute/pkt.h

@@ -0,0 +1,79 @@
+/*
+ * pkt.h
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: pkt.h 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#ifndef PKT_H
+#define PKT_H
+
+#include "config.h"
+#include "defines.h"
+#include "../../lib/queue.h"
+#include <sys/time.h>
+
+/* need to undef these which are pulled in via defines.h prior to import dnet.h */
+#undef icmp_id
+#undef icmp_seq
+#undef icmp_data
+#undef icmp_mask
+#include <dnet.h>
+// #include <event.h>
+
+#define PKT_BUF_LEN	(ETH_HDR_LEN + ETH_MTU)
+#define PKT_BUF_ALIGN	2
+
+struct pkt {
+	struct timeval	 pkt_ts;
+    // struct event  pkt_ev;
+	
+	struct eth_hdr	*pkt_eth;
+	union {
+		u_char		*eth_data;
+		struct ip_hdr	*ip;
+	} pkt_n_hdr_u;
+	union {
+		u_char		*ip_data;
+		struct icmp_hdr	*icmp;
+		struct tcp_hdr	*tcp;
+		struct udp_hdr	*udp;
+	} pkt_t_hdr_u;
+	union {
+		u_char		*t_data;
+		union icmp_msg	*icmp;
+	} pkt_t_data_u;
+
+	u_char		 pkt_buf[PKT_BUF_ALIGN + PKT_BUF_LEN];
+	u_char		*pkt_data;
+	u_char		*pkt_end;
+
+	TAILQ_ENTRY(pkt) pkt_next;
+};
+#define pkt_ip		 pkt_n_hdr_u.ip
+#define pkt_eth_data	 pkt_n_hdr_u.eth_data
+
+#define pkt_icmp	 pkt_t_hdr_u.icmp
+#define pkt_tcp		 pkt_t_hdr_u.tcp
+#define pkt_udp		 pkt_t_hdr_u.udp
+#define pkt_ip_data	 pkt_t_hdr_u.ip_data
+
+#define pkt_tcp_data	 pkt_t_data_u.t_data
+#define pkt_udp_data	 pkt_t_data_u.t_data
+#define pkt_icmp_msg	 pkt_t_data_u.icmp
+
+TAILQ_HEAD(pktq, pkt);
+
+void		 pkt_init(int size);
+
+struct pkt	*pkt_new(void);
+struct pkt	*pkt_dup(struct pkt *);
+void		 pkt_decorate(struct pkt *pkt);
+void		 pkt_free(struct pkt *pkt);
+
+void		 pktq_reverse(struct pktq *pktq);
+void		 pktq_shuffle(rand_t *r, struct pktq *pktq);
+struct pkt	*pktq_random(rand_t *r, struct pktq *pktq);
+
+#endif /* PKT_H */

+ 49 - 0
src/fragroute/randutil.c

@@ -0,0 +1,49 @@
+/*
+ * randutil.c
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: randutil.c 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#include "config.h"
+
+#include <dnet.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "randutil.h"
+
+static const char base64[] =
+	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+void
+rand_strset(rand_t *r, void *buf, size_t len)
+{
+	uint32_t u;
+	char *p;
+	int i;
+
+	p = (char *)buf;
+	i = (len + 3) / 4;
+	u = rand_uint32(r);
+
+	/* XXX - more Duff's device tomfoolery. */
+	switch (len % 4) {
+	case 0: do {
+		u = rand_uint32(r);
+		*p++ = base64[(u >> 18) & 0x3f];
+	case 3:
+		*p++ = base64[(u >> 12) & 0x3f];
+	case 2:
+		*p++ = base64[(u >> 6) & 0x3f];
+	case 1:
+		*p++ = base64[(u >> 0) & 0x3f];
+		} while (--i > 0);
+	}
+	p[-1] = '\0';
+}

+ 14 - 0
src/fragroute/randutil.h

@@ -0,0 +1,14 @@
+/*
+ * randutil.h
+ *
+ * Copyright (c) 2001 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: randutil.h 2000 2008-04-27 06:17:35Z aturner $
+ */
+
+#ifndef RANDUTIL_H
+#define RANDUTIL_H
+
+void		 rand_strset(rand_t *r, void *buf, size_t len);
+
+#endif /* RANDUTIL_H */

+ 237 - 101
src/send_packets.c

@@ -1,7 +1,7 @@
-/* $Id: send_packets.c 1898 2007-08-25 05:10:51Z aturner $ */
+/* $Id: send_packets.c 2008 2008-05-01 18:39:05Z aturner $ */
 
 /*
- * Copyright (c) 2001-2007 Aaron Turner.
+ * Copyright (c) 2001-2008 Aaron Turner.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,6 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
 #include "config.h"
 #include "defines.h"
 #include "common.h"
@@ -58,6 +57,7 @@ extern tcpedit_t *tcpedit;
 #endif /* TCPREPLAY */
 
 #include "send_packets.h"
+#include "sleep.h"
 
 extern tcpreplay_opt_t options;
 extern struct timeval begin, end;
@@ -68,10 +68,11 @@ extern volatile int didsig;
 extern int debug;
 #endif
 
-static void do_sleep(struct timeval *time, struct timeval *last, int len, int accurate, 
-    sendpacket_t *sp, COUNTER counter);
-static u_int32_t sleep_loop(struct timeval time);
-static u_char *get_next_packet(pcap_t *pcap, struct pcap_pkthdr *pkthdr, int file_idx, packet_cache_t **prev_packet);
+static void do_sleep(struct timeval *time, struct timeval *last, int len, 
+    int accurate, sendpacket_t *sp, COUNTER counter, delta_t *ctx);
+static const u_char *get_next_packet(pcap_t *pcap, struct pcap_pkthdr *pkthdr, 
+    int file_idx, packet_cache_t **prev_packet);
+static u_int32_t get_user_count(sendpacket_t *sp, COUNTER counter);
 
 /**
  * the main loop function for tcpreplay.  This is where we figure out
@@ -91,7 +92,8 @@ send_packets(pcap_t *pcap, int cache_file_idx)
 #if defined TCPREPLAY && defined TCPREPLAY_EDIT
     struct pcap_pkthdr *pkthdr_ptr;
 #endif
-
+    delta_t delta_ctx;
+    
     /* register signals */
     didsig = 0;
     if (options.speed.mode != SPEED_ONEATATIME) {
@@ -159,14 +161,19 @@ send_packets(pcap_t *pcap, int cache_file_idx)
 
         /*
          * we have to cast the ts, since OpenBSD sucks
-         * had to be special and use bpf_timeval 
+         * had to be special and use bpf_timeval.
+         * Only sleep if we're not in top speed mode (-t)
          */
-        do_sleep((struct timeval *)&pkthdr.ts, &last, pktlen, options.accurate, sp, packetnum);
-            
+        if (options.speed.mode != SPEED_TOPSPEED)
+            do_sleep((struct timeval *)&pkthdr.ts, &last, pktlen, options.accurate, sp, packetnum, &delta_ctx);
+        
+        /* mark the time when we send the packet */
+        start_delta_time(&delta_ctx);
+        
         /* write packet out on network */
         if (sendpacket(sp, pktdata, pktlen) < (int)pktlen)
             warnx("Unable to send packet: %s", sendpacket_geterr(sp));
-		
+
         /* 
          * track the time of the "last packet sent".  Again, because of OpenBSD
          * we have to do a mempcy rather then assignment. 
@@ -193,7 +200,7 @@ send_packets(pcap_t *pcap, int cache_file_idx)
  * This should be NULL on the first call to this function for each file and
  * will be updated as new entries are added (or retrieved) from the cache list.
  */
-static u_char *
+static const u_char *
 get_next_packet(pcap_t *pcap, struct pcap_pkthdr *pkthdr, int file_idx, 
     packet_cache_t **prev_packet)
 {
@@ -232,7 +239,7 @@ get_next_packet(pcap_t *pcap, struct pcap_pkthdr *pkthdr, int file_idx,
 			/*
 			 * We should read the pcap file, and cache the results
 			 */
-			pktdata = pcap_next(pcap, pkthdr);
+			pktdata = (u_char *)pcap_next(pcap, pkthdr);
 			if (pktdata != NULL) {
 				if (*prev_packet == NULL) {
 					/*
@@ -262,9 +269,10 @@ get_next_packet(pcap_t *pcap, struct pcap_pkthdr *pkthdr, int file_idx,
 		/*
 		 * Read pcap file as normal
 		 */
-		pktdata = pcap_next(pcap, pkthdr);
+		pktdata = (u_char *)pcap_next(pcap, pkthdr);
 	}
 
+    /* this get's casted to a const on the way out */
 	return pktdata;
 }
 
@@ -309,52 +317,71 @@ cache_mode(char *cachedata, COUNTER packet_num)
  * calculate the appropriate amount of time to sleep and do so.
  */
 static void
-do_sleep(struct timeval *time, struct timeval *last, int len, int accurate, sendpacket_t *sp,
-    COUNTER counter)
+do_sleep(struct timeval *time, struct timeval *last, int len, int accurate, 
+    sendpacket_t *sp, COUNTER counter, delta_t *delta_ctx)
 {
     static struct timeval didsleep = { 0, 0 };
     static struct timeval start = { 0, 0 };
 #ifdef DEBUG
     static struct timeval totalsleep = { 0, 0 };
 #endif
-    struct timeval nap, now, delta;
-    struct timespec ignore, sleep;
+    struct timespec adjuster = { 0, 0 };
+    static struct timespec nap = { 0, 0 }, delta_time = {0, 0};
+    struct timeval nap_for, now, sleep_until;
+    struct timespec nap_this_time;
+    static int32_t nsec_adjuster = -1, nsec_times = -1;
     float n;
-    struct pollfd poller[1];        /* use poll to read from the keyboard */
-    char input[EBUF_SIZE];
-    static u_int32_t send = 0;      /* remember # of packets to send btw calls */
-    u_int32_t loop;
+    static u_int32_t send = 0;      /* accellerator.   # of packets to send w/o sleeping */
+    u_int64_t ppnsec; /* packets per usec */
 
-    /* just return if topspeed */
-    if (options.speed.mode == SPEED_TOPSPEED)
-        return;
 
-    dbgx(3, "Last time: " TIMEVAL_FORMAT, last->tv_sec, last->tv_usec);
+#ifdef TCPREPLAY
+    adjuster.tv_nsec = OPT_VALUE_SLEEP_ACCEL * 1000;
+    dbgx(2, "Adjuster: " TIMEVAL_FORMAT, adjuster.tv_sec, adjuster.tv_nsec);
+#else
+    adjuster.tv_nsec = 0;
+#endif
+    
+    /* acclerator time? */
+    if (send > 0) {
+        send --;
+        return;
+    }
+        
+    dbgx(4, "Last time: " TIMEVAL_FORMAT, last->tv_sec, last->tv_usec);
 
-    if (gettimeofday(&now, NULL) < 0) {
+    if (gettimeofday(&now, NULL) < 0)
         errx(1, "Error gettimeofday: %s", strerror(errno));
-    }
 
-    dbgx(3, "Now time: " TIMEVAL_FORMAT, now.tv_sec, now.tv_usec);
+    dbgx(4, "Now time: " TIMEVAL_FORMAT, now.tv_sec, now.tv_usec);
 
     /* First time through for this file */
     if (pkts_sent == 0 || ((options.speed.mode != SPEED_MBPSRATE) && (counter == 0))) {
         start = now;
-        timerclear(&delta);
+        timerclear(&sleep_until);
         timerclear(&didsleep);
     }
     else {
-        timersub(&now, &start, &delta);
+        timersub(&now, &start, &sleep_until);
     }
 
     switch(options.speed.mode) {
+    /* 
+     * If top speed, you shouldn't even be here, but handle it anyways
+     */
+    case SPEED_TOPSPEED:
+        notice("you shouldn't call do_sleep() in top speed mode.");
+        return;
+        break;
+        
     case SPEED_MULTIPLIER:
         /* 
          * Replay packets a factor of the time they were originally sent.
          */
         if (timerisset(last) && timercmp(time, last, >)) {
-            timersub(time, last, &nap);
-            timerdiv(&nap, options.speed.speed);
+            timersub(time, last, &nap_for);
+            TIMEVAL_TO_TIMESPEC(&nap_for, &nap);
+            timesdiv(&nap, options.speed.speed);
         }
         else {
             /* 
@@ -362,8 +389,8 @@ do_sleep(struct timeval *time, struct timeval *last, int len, int accurate, send
              * this packet appears to have been sent before the 
              * last packet.
              */
-            timerclear(&nap);
-        }
+            timesclear(&nap);
+        }        
         break;
 
     case SPEED_MBPSRATE:
@@ -374,60 +401,31 @@ do_sleep(struct timeval *time, struct timeval *last, int len, int accurate, send
         if (pkts_sent != 0) {
             n = (float)len / (options.speed.speed * 1024 * 1024 / 8); /* convert Mbps to bps */
             nap.tv_sec = n;
-            nap.tv_usec = (n - nap.tv_sec) * 1000000;
+            nap.tv_nsec = (n - nap.tv_sec)  * 1000000000;
+            
             dbgx(3, "packet size %d\t\tequals %f bps\t\tnap " TIMEVAL_FORMAT, len, n, 
-                nap.tv_sec, nap.tv_usec);
+                nap.tv_sec, nap.tv_nsec);
         }
         else {
-            timerclear(&nap);
+            /* don't sleep at all for the first packet */
+            timesclear(&nap);
         }
         break;
 
     case SPEED_PACKETRATE:
-        /* run in packets/sec */
-        n = 1 / options.speed.speed;
-        nap.tv_sec = n;
-        n -= nap.tv_sec;
-        nap.tv_usec = n * 1000000;
+        /* only need to calculate this the first time */
+        if (! timesisset(&nap)) {
+            /* run in packets/sec */
+            ppnsec = 1000000000 / options.speed.speed;
+            NANOSEC_TO_TIMESPEC(ppnsec, &nap);
+            dbgx(1, "sending 1 packet per %lu nsec", nap.tv_nsec);
+        }
         break;
-
+        
     case SPEED_ONEATATIME:
         /* do we skip prompting for a key press? */
         if (send == 0) {
-            printf("**** Next packet #" COUNTER_SPEC " out %s.  How many packets do you wish to send? ",
-                counter, (sp == options.intf1 ? options.intf1_name : options.intf2_name));
-            fflush(NULL);
-            poller[0].fd = STDIN_FILENO;
-            poller[0].events = POLLIN | POLLPRI | POLLNVAL;
-            poller[0].revents = 0;
-
-            if (fcntl(0, F_SETFL, fcntl(0, F_GETFL) & ~O_NONBLOCK)) 
-                   errx(1, "Unable to clear non-blocking flag on stdin: %s", strerror(errno));
-
-            /* wait for the input */
-            if (poll(poller, 1, -1) < 0)
-                errx(1, "Error reading user input from stdin: %s", strerror(errno));
-            
-            /*
-             * read to the end of the line or EBUF_SIZE,
-             * Note, if people are stupid, and type in more text then EBUF_SIZE
-             * then the next fgets() will pull in that data, which will have poor 
-             * results.  fuck them.
-             */
-            if (fgets(input, sizeof(input), stdin) == NULL) {
-                errx(1, "Unable to process user input for fd %d: %s", fileno(stdin), strerror(errno));
-            } else if (strlen(input) > 1) {
-                send = strtoul(input, NULL, 0);
-            }
-
-            /* how many packets should we send? */
-            if (send == 0) {
-                dbg(1, "Input was less then 1 or non-numeric, assuming 1");
-
-                /* assume send only one packet */
-                send = 1;
-            }
-            
+            send = get_user_count(sp, counter);
         }
 
         /* decrement our send counter */
@@ -445,32 +443,138 @@ do_sleep(struct timeval *time, struct timeval *last, int len, int accurate, send
         break;
     }
 
-    if (!accurate) {
-        timeradd(&didsleep, &nap, &didsleep);
+    /* 
+     * since we apply the adjuster to the sleep time, we can't modify nap
+     */
+    nap_this_time.tv_sec = nap.tv_sec;
+    nap_this_time.tv_nsec = nap.tv_nsec;
+
+    if (accurate != ACCURATE_ABS_TIME) {
+
+        switch (options.speed.mode) {
+            /* Mbps & Multipler are dynamic timings, so we round to the nearest usec */
+            case SPEED_MBPSRATE:
+            case SPEED_MULTIPLIER:
+                ROUND_TIMESPEC_TO_MICROSEC(&nap_this_time);
+                break;
+
+            /* Packets/sec is static, so we weight packets for .1usec accuracy */
+            case SPEED_PACKETRATE:
+                if (nsec_adjuster < 0)
+                    nsec_adjuster = (nap_this_time.tv_nsec % 10000) / 1000;
+        
+                /* update in the range of 0-9 */
+                nsec_times = (nsec_times + 1) % 10;
+        
+                if (nsec_times < nsec_adjuster) {
+                    /* sorta looks like a no-op, but gives us a nice round usec number */
+                    nap_this_time.tv_nsec = (nap_this_time.tv_nsec / 1000 * 1000) + 1000;
+                } else {
+                    nap_this_time.tv_nsec -= (nap_this_time.tv_nsec % 1000);
+                }
+    
+                dbgx(3, "(%ld)\tnsec_times = %ld\tnap adjust: %lu -> %lu", nsec_adjuster, nsec_times, nap.tv_nsec, nap_this_time.tv_nsec);            
+                break;
+                
+            default:
+                errx(1, "Unknown/supported speed mode: %d", options.speed.mode);
+        }
+    }
+
+
+    get_delta_time(delta_ctx, &delta_time);
+    dbgx(2, "delta: " TIMESPEC_FORMAT, delta_time.tv_sec, delta_time.tv_nsec);
+
+    if (timesisset(&delta_time)) {
+        if (timescmp(&nap_this_time, &delta_time, >)) {
+            timessub(&nap_this_time, &delta_time, &nap_this_time);
+            dbgx(3, "timesub: %lu %lu", delta_time.tv_sec, delta_time.tv_nsec);
+        } else { 
+            timesclear(&nap_this_time);
+            dbgx(3, "timesclear: " TIMESPEC_FORMAT, delta_time.tv_sec, delta_time.tv_nsec);
+        }
+    }
+
+    /* apply the adjuster... */
+    if (timesisset(&adjuster)) {
+        if (timescmp(&nap_this_time, &adjuster, >)) {
+            timessub(&nap_this_time, &adjuster, &nap_this_time);
+        } else { 
+            timesclear(&nap_this_time);
+        }
+    }
+    
+    dbgx(2, "Sleeping: " TIMESPEC_FORMAT, nap_this_time.tv_sec, nap_this_time.tv_nsec);
+
+    /* don't sleep if nap = {0, 0} */
+    if (!timesisset(&nap_this_time))
+        return;
+        
+    /*
+     * Depending on the accurate method & packet rate computation method
+     * We have multiple methods of sleeping, pick the right one...
+     */
+    switch (accurate) {
+#ifdef HAVE_SELECT
+    case ACCURATE_SELECT:
+        select_sleep(nap_this_time);
+        break;
+#endif
+
+#ifdef HAVE_IOPERM
+    case ACCURATE_IOPORT:
+        ioport_sleep(nap_this_time);
+        break;
+#endif
 
-        dbgx(4, "I will sleep " TIMEVAL_FORMAT, nap.tv_sec, nap.tv_usec);
+#ifdef HAVE_RDTSC        
+    case ACCURATE_RDTSC:
+        rdtsc_sleep(nap_this_time);
+        break;
+#endif
 
-        if (timercmp(&didsleep, &delta, >)) {
-            timersub(&didsleep, &delta, &nap);
+#ifdef HAVE_ABSOLUTE_TIME
+    case ACCURATE_ABS_TIME:
+        absolute_time_sleep(nap_this_time);
+        break;
+#endif
+
+    case ACCURATE_GTOD:
+        gettimeofday_sleep(nap_this_time);
+        break;
 
-            sleep.tv_sec = nap.tv_sec;
-            sleep.tv_nsec = nap.tv_usec * 1000; /* convert microsec to ns */
-            dbgx(4, "Sleeping " TIMEVAL_FORMAT, nap.tv_sec, nap.tv_usec);
+    case ACCURATE_NANOSLEEP:
+        nanosleep_sleep(nap_this_time);
+        break;
+        /*
+        timeradd(&didsleep, &nap_this_time, &didsleep);
+
+        dbgx(4, "I will sleep " TIMEVAL_FORMAT, nap_this_time.tv_sec, nap_this_time.tv_usec);
+
+        if (timercmp(&didsleep, &sleep_until, >)) {
+            timersub(&didsleep, &sleep_until, &nap_this_time);
+            
+            TIMEVAL_TO_TIMESPEC(&nap_this_time, &sleep);
+            dbgx(4, "Sleeping " TIMEVAL_FORMAT, nap_this_time.tv_sec, nap_this_time.tv_usec);
 #ifdef DEBUG
-            timeradd(&totalsleep, &nap, &totalsleep);
+            timeradd(&totalsleep, &nap_this_time, &totalsleep);
 #endif
             if (nanosleep(&sleep, &ignore) == -1) {
                 warnx("nanosleep error: %s", strerror(errno));
             }
         }
-    } else {
-        timeradd(&now, &nap, &delta);
-        loop = sleep_loop(delta);
-        dbgx(3, "sleep_loop looped %u times", loop);
+        break;
+        */
+    default:
+        errx(1, "Unknown timer mode %d", accurate);
     }
+
 #ifdef DEBUG
     dbgx(4, "Total sleep time: " TIMEVAL_FORMAT, totalsleep.tv_sec, totalsleep.tv_usec);
 #endif
+
+    dbgx(2, "sleep delta: " TIMESPEC_FORMAT, delta_time.tv_sec, delta_time.tv_nsec);
+
 }
 
 /**
@@ -478,16 +582,48 @@ do_sleep(struct timeval *time, struct timeval *last, int len, int accurate, send
  * >= time.  This should be a lot more accurate then using nanosleep(),
  * but at the cost of being more CPU intensive.
  */
-static u_int32_t 
-sleep_loop(struct timeval time)
+static u_int32_t
+get_user_count(sendpacket_t *sp, COUNTER counter) 
 {
-   struct timeval now;
-   u_int32_t loop = 0;
-   do {
-        gettimeofday(&now, NULL);
-        loop ++;
-   } while (now.tv_sec < time.tv_sec || now.tv_usec < time.tv_usec);
-   return loop;
+    struct pollfd poller[1];        /* use poll to read from the keyboard */
+    char input[EBUF_SIZE];
+    u_int32_t send = 0;
+    
+    printf("**** Next packet #" COUNTER_SPEC " out %s.  How many packets do you wish to send? ",
+        counter, (sp == options.intf1 ? options.intf1_name : options.intf2_name));
+    fflush(NULL);
+    poller[0].fd = STDIN_FILENO;
+    poller[0].events = POLLIN | POLLPRI | POLLNVAL;
+    poller[0].revents = 0;
+
+    if (fcntl(0, F_SETFL, fcntl(0, F_GETFL) & ~O_NONBLOCK)) 
+           errx(1, "Unable to clear non-blocking flag on stdin: %s", strerror(errno));
+
+    /* wait for the input */
+    if (poll(poller, 1, -1) < 0)
+        errx(1, "Error reading user input from stdin: %s", strerror(errno));
+    
+    /*
+     * read to the end of the line or EBUF_SIZE,
+     * Note, if people are stupid, and type in more text then EBUF_SIZE
+     * then the next fgets() will pull in that data, which will have poor 
+     * results.  fuck them.
+     */
+    if (fgets(input, sizeof(input), stdin) == NULL) {
+        errx(1, "Unable to process user input for fd %d: %s", fileno(stdin), strerror(errno));
+    } else if (strlen(input) > 1) {
+        send = strtoul(input, NULL, 0);
+    }
+
+    /* how many packets should we send? */
+    if (send == 0) {
+        dbg(1, "Input was less then 1 or non-numeric, assuming 1");
+
+        /* assume send only one packet */
+        send = 1;
+    }
+    
+    return send;
 }
 
 /*

+ 101 - 0
src/sleep.c

@@ -0,0 +1,101 @@
+/* $Id:$ */
+
+/*
+ * Copyright (c) 2008 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 <sys/types.h>
+#include <sys/time.h>
+#include <unistd.h>     
+#include <errno.h>
+#include <string.h>
+
+#ifdef HAVE_SYS_EVENT
+#include <sys/event.h>
+#endif
+
+/* necessary for ioport_sleep() functions */
+#ifdef HAVE_SYS_IO_H /* Linux */
+#include <sys/io.h>
+#elif defined HAVE_ARCHITECTURE_I386_PIO_H /* OS X */
+#include <architecture/i386/pio.h>
+#endif
+
+float gettimeofday_sleep_value;
+int ioport_sleep_value;
+
+
+void 
+ioport_sleep_init(void) 
+{
+#ifdef HAVE_IOPERM
+    ioperm(0x80,1,1);
+    ioport_sleep_value = inb(0x80);    
+#else
+    err(1, "Platform does not support IO Port for timing");
+#endif
+}
+
+void 
+ioport_sleep(const struct timespec nap) 
+{
+#ifdef HAVE_IOPERM
+    struct timeval nap_for;
+    u_int32_t usec;
+    time_t i;
+    
+    TIMESPEC_TO_TIMEVAL(&nap_for, &nap);
+    
+    /* 
+     * process the seconds, we do this in a loop so we don't have to 
+     * use slower 64bit integers or worry about integer overflows.
+     */
+    for (i = 0; i < nap_for.tv_sec; i ++) {
+        usec = SEC_TO_MICROSEC(nap_for.tv_sec);
+        while (usec > 0) {
+            usec --;
+            outb(ioport_sleep_value, 0x80);
+        }
+    }
+    
+    /* process the usec */
+    usec = nap.tv_nsec / 1000;
+    usec --; /* fudge factor for all the above */
+    while (usec > 0) {
+        usec --;
+    	outb(ioport_sleep_value, 0x80);
+    }
+#else
+    err(1, "Platform does not support IO Port for timing");
+#endif
+}

+ 146 - 0
src/sleep.h

@@ -0,0 +1,146 @@
+/* $Id:$ */
+
+/*
+ * Copyright (c) 2008 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"
+
+#ifdef HAVE_SYS_SELECT  /* According to POSIX 1003.1-2001 */
+#include <sys/select.h>
+#endif                   
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <unistd.h>     
+#include <errno.h>
+#include <string.h>
+#ifdef HAVE_SYS_EVENT
+#include <sys/event.h>
+#endif
+
+/* necessary for ioport_sleep() functions */
+#ifdef HAVE_SYS_IO_H /* Linux */
+#include <sys/io.h>
+#elif defined HAVE_ARCHITECTURE_I386_PIO_H /* OS X */
+#include <architecture/i386/pio.h>
+#endif
+
+
+#ifndef __SLEEP_H__
+#define __SLEEP_H__
+
+static inline void
+nanosleep_sleep(struct timespec nap)
+{
+    nanosleep(&nap, NULL);
+}
+
+
+/*
+ * Straight forward... keep calling gettimeofday() unti the apporpriate amount
+ * of time has passed.  Pretty damn accurate from 1 to 100Mbps
+ */
+static inline void
+gettimeofday_sleep(struct timespec nap)
+{
+    struct timeval now, sleep_until, nap_for;
+    gettimeofday(&now, NULL);
+    TIMESPEC_TO_TIMEVAL(&nap_for, &nap);
+    timeradd(&now, &nap_for, &sleep_until);
+    
+    do {
+        gettimeofday(&now, NULL);
+    } while (timercmp(&now, &sleep_until, <));
+}
+
+
+#ifdef HAVE_ABSOLUTE_TIME
+#include <CoreServices/CoreServices.h>
+
+/* 
+ * Apple's AbsoluteTime functions give at least .1usec precision
+ * which is pretty damn sweet
+ */
+static inline void
+absolute_time_sleep(struct timespec nap)
+{
+    AbsoluteTime sleep_until, naptime, time_left;
+    Nanoseconds nanosec;
+
+    nanosec = UInt64ToUnsignedWide(TIMESPEC_TO_NANOSEC(&nap));
+    naptime = NanosecondsToAbsolute(nanosec);
+
+    sleep_until = AddAbsoluteToAbsolute(UpTime(), naptime);
+
+    do {
+        time_left = SubAbsoluteFromAbsolute(sleep_until, UpTime());
+    } while (NonZero(time_left));
+}
+
+#endif /* HAVE_ABSOLUTE_TIME */
+
+
+
+#ifdef HAVE_SELECT
+/* 
+ * sleep for some time using the select() call timeout method.   This is 
+ * highly portable for sub-second sleeping, but only for about 1msec
+ * resolution which is pretty much useless for our needs.  Keeping it here
+ * for furture reference
+ */
+static inline void 
+select_sleep(const struct timespec nap)
+{
+    struct timeval timeout;
+
+    TIMESPEC_TO_TIMEVAL(&timeout, &nap);
+
+    if (select(0, NULL, NULL, NULL, &timeout) < 0)
+        warnx("select_sleep() returned early due to error: %s", strerror(errno));
+}
+#endif /* HAVE_SELECT */
+
+/*
+ * ioport_sleep() only works on Intel and quite possibly only Linux.
+ * But the basic idea is to write to the IO Port 0x80 which should
+ * take exactly 1usec regardless of the CPU speed and without 
+ * calling a sleep method which allows the kernel to service another thread
+ * Idea stolen from: http://c-faq.com/osdep/sd25.html
+ */
+extern int ioport_sleep_value;
+
+/* before calling port_sleep(), you have to call port_sleep_init() */
+void ioport_sleep_init(void);
+
+void ioport_sleep(const struct timespec nap);
+
+#endif /* __SLEEP_H__ */

+ 16 - 3
src/tcpbridge.1

@@ -1,7 +1,7 @@
-.TH TCPBRIDGE 1 2008-01-16 "(tcpbridge )" "Programmer's Manual"
+.TH TCPBRIDGE 1 2008-05-15 "(tcpbridge )" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (tcpbridge.1)
 .\"  
-.\"  It has been AutoGen-ed  Wednesday January 16, 2008 at 10:09:47 PM PST
+.\"  It has been AutoGen-ed  Thursday May 15, 2008 at 08:51:21 AM PDT
 .\"  From the definitions    tcpbridge_opts.def
 .\"  and the template file   agman1.tpl
 .\"
@@ -136,6 +136,19 @@ actually exists in the frame, we just blindly delete the last two bytes.  Hence,
 you should only use this if you know know that your OS provides the FCS when 
 reading raw packets.
 .TP
+.BR \--ttl "=\fIstring\fP"
+Modify the IPv4 TTL.
+.sp
+Allows you to modify the TTL of all the IPv4 packets.  Specify a number to hard-code
+the value or +/-value to increase or decrease by the value provided (limited to 1-255).    
+
+Examples:
+.nf
+    \--ttl=10
+    \--ttl=+7
+    \--ttl=-64
+.fi
+.TP
 .BR \-F " \fIstring\fP, " \--fixlen "=" \fIstring\fP
 Pad or truncate packet data to match header length.
 This option may appear up to 1 times.
@@ -522,7 +535,7 @@ Some operating systems by default do not allow for forging source MAC
 addresses.  Please consult your operating system's documentation and the
 tcpreplay FAQ if you experiance this issue.
 .SH AUTHOR
-Copyright 2000-2007 Aaron Turner
+Copyright 2000-2008 Aaron Turner
 
 For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
 

+ 2 - 2
src/tcpbridge.c

@@ -1,4 +1,4 @@
-/* $Id: tcpbridge.c 1842 2007-04-26 04:34:11Z aturner $ */
+/* $Id: tcpbridge.c 2027 2008-05-15 16:54:58Z aturner $ */
 
 /*
  * Copyright (c) 2004-2005 Aaron Turner.
@@ -122,7 +122,7 @@ main(int argc, char *argv[])
     sendpacket_close(options.sp1);
     pcap_close(options.listen1);
 
-    if (! options.unidir) {
+    if (options.unidir) {
         sendpacket_close(options.sp2);
         pcap_close(options.listen2);
     }

+ 6 - 1
src/tcpbridge.h

@@ -1,4 +1,4 @@
-/* $Id: tcpbridge.h 1795 2007-04-11 04:51:58Z aturner $ */
+/* $Id: tcpbridge.h 1944 2008-01-14 01:13:38Z aturner $ */
 
 /*
  * Copyright (c) 2005 Aaron Turner.
@@ -46,6 +46,11 @@
 #include <fcntl.h>
 #include <regex.h>
 
+#ifdef ENABLE_DMALLOC
+#include <dmalloc.h>
+#endif
+
+
 /* run-time options */
 struct tcpbridge_opt_s {
     char *intf1;

+ 77 - 55
src/tcpbridge_opts.c

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpbridge_opts.c)
  *  
- *  It has been AutoGen-ed  Wednesday January 16, 2008 at 10:09:46 PM PST
+ *  It has been AutoGen-ed  Thursday May 15, 2008 at 08:51:18 AM PDT
  *  From the definitions    tcpbridge_opts.def
  *  and the template file   options
  *
@@ -20,7 +20,7 @@
  *
  * This source file is copyrighted and licensed under the following terms:
  *
- * tcpbridge copyright 2005-2007 Aaron Turner - all rights reserved
+ * tcpbridge copyright 2005-2008 Aaron Turner - all rights reserved
  *
  * tcpbridge is free software copyrighted by Aaron Turner.
  * 
@@ -59,7 +59,7 @@
 extern "C" {
 #endif
 tSCC zCopyright[] =
-       "tcpbridge copyright (c) 2005-2007 Aaron Turner, all rights reserved";
+       "tcpbridge copyright (c) 2005-2008 Aaron Turner, all rights reserved";
 tSCC zCopyrightNotice[] =
        "tcpbridge is free software copyrighted by Aaron Turner.\n\n\
 Redistribution and use in source and binary forms, with or without\n\
@@ -240,6 +240,16 @@ tSCC    zEfcs_Name[]               = "efcs";
 #define EFCS_FLAGS       (OPTST_DISABLED)
 
 /*
+ *  Ttl option description:
+ */
+tSCC    zTtlText[] =
+        "Modify the IPv4 TTL";
+tSCC    zTtl_NAME[]                = "TTL";
+tSCC    zTtl_Name[]                = "ttl";
+#define TTL_FLAGS       (OPTST_DISABLED \
+        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
  *  Fixlen option description:
  */
 tSCC    zFixlenText[] =
@@ -712,8 +722,20 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zEfcsText, zEfcs_NAME, zEfcs_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 11, VALUE_OPT_FIXLEN,
-     /* equiv idx, value */ 11, VALUE_OPT_FIXLEN,
+  {  /* entry idx, value */ 11, VALUE_OPT_TTL,
+     /* equiv idx, value */ 11, VALUE_OPT_TTL,
+     /* equivalenced to  */ NO_EQUIVALENT,
+     /* min, max, act ct */ 0, 1, 0,
+     /* opt state flags  */ TTL_FLAGS, 0,
+     /* last opt argumnt */ { NULL },
+     /* arg list/cookie  */ NULL,
+     /* must/cannot opts */ NULL, NULL,
+     /* option proc      */ NULL,
+     /* desc, NAME, name */ zTtlText, zTtl_NAME, zTtl_Name,
+     /* disablement strs */ NULL, NULL },
+
+  {  /* entry idx, value */ 12, VALUE_OPT_FIXLEN,
+     /* equiv idx, value */ 12, VALUE_OPT_FIXLEN,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ FIXLEN_FLAGS, 0,
@@ -724,8 +746,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zFixlenText, zFixlen_NAME, zFixlen_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 12, VALUE_OPT_SKIPL2BROADCAST,
-     /* equiv idx, value */ 12, VALUE_OPT_SKIPL2BROADCAST,
+  {  /* entry idx, value */ 13, VALUE_OPT_SKIPL2BROADCAST,
+     /* equiv idx, value */ 13, VALUE_OPT_SKIPL2BROADCAST,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ SKIPL2BROADCAST_FLAGS, 0,
@@ -736,8 +758,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zSkipl2broadcastText, zSkipl2broadcast_NAME, zSkipl2broadcast_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 13, VALUE_OPT_DLT,
-     /* equiv idx, value */ 13, VALUE_OPT_DLT,
+  {  /* entry idx, value */ 14, VALUE_OPT_DLT,
+     /* equiv idx, value */ 14, VALUE_OPT_DLT,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ DLT_FLAGS, 0,
@@ -748,8 +770,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zDltText, zDlt_NAME, zDlt_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 14, VALUE_OPT_ENET_DMAC,
-     /* equiv idx, value */ 14, VALUE_OPT_ENET_DMAC,
+  {  /* entry idx, value */ 15, VALUE_OPT_ENET_DMAC,
+     /* equiv idx, value */ 15, VALUE_OPT_ENET_DMAC,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ ENET_DMAC_FLAGS, 0,
@@ -760,8 +782,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zEnet_DmacText, zEnet_Dmac_NAME, zEnet_Dmac_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 15, VALUE_OPT_ENET_SMAC,
-     /* equiv idx, value */ 15, VALUE_OPT_ENET_SMAC,
+  {  /* entry idx, value */ 16, VALUE_OPT_ENET_SMAC,
+     /* equiv idx, value */ 16, VALUE_OPT_ENET_SMAC,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ ENET_SMAC_FLAGS, 0,
@@ -772,8 +794,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zEnet_SmacText, zEnet_Smac_NAME, zEnet_Smac_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 16, VALUE_OPT_ENET_VLAN,
-     /* equiv idx, value */ 16, VALUE_OPT_ENET_VLAN,
+  {  /* entry idx, value */ 17, VALUE_OPT_ENET_VLAN,
+     /* equiv idx, value */ 17, VALUE_OPT_ENET_VLAN,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ ENET_VLAN_FLAGS, 0,
@@ -784,8 +806,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zEnet_VlanText, zEnet_Vlan_NAME, zEnet_Vlan_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 17, VALUE_OPT_ENET_VLAN_TAG,
-     /* equiv idx, value */ 17, VALUE_OPT_ENET_VLAN_TAG,
+  {  /* entry idx, value */ 18, VALUE_OPT_ENET_VLAN_TAG,
+     /* equiv idx, value */ 18, VALUE_OPT_ENET_VLAN_TAG,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ ENET_VLAN_TAG_FLAGS, 0,
@@ -796,8 +818,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zEnet_Vlan_TagText, zEnet_Vlan_Tag_NAME, zEnet_Vlan_Tag_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 18, VALUE_OPT_ENET_VLAN_CFI,
-     /* equiv idx, value */ 18, VALUE_OPT_ENET_VLAN_CFI,
+  {  /* entry idx, value */ 19, VALUE_OPT_ENET_VLAN_CFI,
+     /* equiv idx, value */ 19, VALUE_OPT_ENET_VLAN_CFI,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ ENET_VLAN_CFI_FLAGS, 0,
@@ -808,8 +830,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zEnet_Vlan_CfiText, zEnet_Vlan_Cfi_NAME, zEnet_Vlan_Cfi_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 19, VALUE_OPT_ENET_VLAN_PRI,
-     /* equiv idx, value */ 19, VALUE_OPT_ENET_VLAN_PRI,
+  {  /* entry idx, value */ 20, VALUE_OPT_ENET_VLAN_PRI,
+     /* equiv idx, value */ 20, VALUE_OPT_ENET_VLAN_PRI,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ ENET_VLAN_PRI_FLAGS, 0,
@@ -820,8 +842,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zEnet_Vlan_PriText, zEnet_Vlan_Pri_NAME, zEnet_Vlan_Pri_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 20, VALUE_OPT_HDLC_CONTROL,
-     /* equiv idx, value */ 20, VALUE_OPT_HDLC_CONTROL,
+  {  /* entry idx, value */ 21, VALUE_OPT_HDLC_CONTROL,
+     /* equiv idx, value */ 21, VALUE_OPT_HDLC_CONTROL,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ HDLC_CONTROL_FLAGS, 0,
@@ -832,8 +854,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zHdlc_ControlText, zHdlc_Control_NAME, zHdlc_Control_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 21, VALUE_OPT_HDLC_ADDRESS,
-     /* equiv idx, value */ 21, VALUE_OPT_HDLC_ADDRESS,
+  {  /* entry idx, value */ 22, VALUE_OPT_HDLC_ADDRESS,
+     /* equiv idx, value */ 22, VALUE_OPT_HDLC_ADDRESS,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ HDLC_ADDRESS_FLAGS, 0,
@@ -844,8 +866,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zHdlc_AddressText, zHdlc_Address_NAME, zHdlc_Address_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 22, VALUE_OPT_USER_DLT,
-     /* equiv idx, value */ 22, VALUE_OPT_USER_DLT,
+  {  /* entry idx, value */ 23, VALUE_OPT_USER_DLT,
+     /* equiv idx, value */ 23, VALUE_OPT_USER_DLT,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ USER_DLT_FLAGS, 0,
@@ -856,8 +878,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zUser_DltText, zUser_Dlt_NAME, zUser_Dlt_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 23, VALUE_OPT_USER_DLINK,
-     /* equiv idx, value */ 23, VALUE_OPT_USER_DLINK,
+  {  /* entry idx, value */ 24, VALUE_OPT_USER_DLINK,
+     /* equiv idx, value */ 24, VALUE_OPT_USER_DLINK,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 2, 0,
      /* opt state flags  */ USER_DLINK_FLAGS, 0,
@@ -868,8 +890,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zUser_DlinkText, zUser_Dlink_NAME, zUser_Dlink_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 24, VALUE_OPT_DBUG,
-     /* equiv idx, value */ 24, VALUE_OPT_DBUG,
+  {  /* entry idx, value */ 25, VALUE_OPT_DBUG,
+     /* equiv idx, value */ 25, VALUE_OPT_DBUG,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ DBUG_FLAGS, 0,
@@ -880,8 +902,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zDbugText, zDbug_NAME, zDbug_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 25, VALUE_OPT_INTF1,
-     /* equiv idx, value */ 25, VALUE_OPT_INTF1,
+  {  /* entry idx, value */ 26, VALUE_OPT_INTF1,
+     /* equiv idx, value */ 26, VALUE_OPT_INTF1,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 1, 1, 0,
      /* opt state flags  */ INTF1_FLAGS, 0,
@@ -892,8 +914,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zIntf1Text, zIntf1_NAME, zIntf1_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 26, VALUE_OPT_INTF2,
-     /* equiv idx, value */ 26, VALUE_OPT_INTF2,
+  {  /* entry idx, value */ 27, VALUE_OPT_INTF2,
+     /* equiv idx, value */ 27, VALUE_OPT_INTF2,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ INTF2_FLAGS, 0,
@@ -904,8 +926,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zIntf2Text, zIntf2_NAME, zIntf2_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 27, VALUE_OPT_UNIDIR,
-     /* equiv idx, value */ 27, VALUE_OPT_UNIDIR,
+  {  /* entry idx, value */ 28, VALUE_OPT_UNIDIR,
+     /* equiv idx, value */ 28, VALUE_OPT_UNIDIR,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ UNIDIR_FLAGS, 0,
@@ -916,8 +938,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zUnidirText, zUnidir_NAME, zUnidir_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 28, VALUE_OPT_LIMIT,
-     /* equiv idx, value */ 28, VALUE_OPT_LIMIT,
+  {  /* entry idx, value */ 29, VALUE_OPT_LIMIT,
+     /* equiv idx, value */ 29, VALUE_OPT_LIMIT,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ LIMIT_FLAGS, 0,
@@ -928,8 +950,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zLimitText, zLimit_NAME, zLimit_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 29, VALUE_OPT_INCLUDE,
-     /* equiv idx, value */ 29, VALUE_OPT_INCLUDE,
+  {  /* entry idx, value */ 30, VALUE_OPT_INCLUDE,
+     /* equiv idx, value */ 30, VALUE_OPT_INCLUDE,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ INCLUDE_FLAGS, 0,
@@ -940,8 +962,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zIncludeText, zInclude_NAME, zInclude_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 30, VALUE_OPT_EXCLUDE,
-     /* equiv idx, value */ 30, VALUE_OPT_EXCLUDE,
+  {  /* entry idx, value */ 31, VALUE_OPT_EXCLUDE,
+     /* equiv idx, value */ 31, VALUE_OPT_EXCLUDE,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ EXCLUDE_FLAGS, 0,
@@ -952,8 +974,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zExcludeText, zExclude_NAME, zExclude_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 31, VALUE_OPT_PID,
-     /* equiv idx, value */ 31, VALUE_OPT_PID,
+  {  /* entry idx, value */ 32, VALUE_OPT_PID,
+     /* equiv idx, value */ 32, VALUE_OPT_PID,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ PID_FLAGS, 0,
@@ -964,8 +986,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zPidText, zPid_NAME, zPid_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 32, VALUE_OPT_VERBOSE,
-     /* equiv idx, value */ 32, VALUE_OPT_VERBOSE,
+  {  /* entry idx, value */ 33, VALUE_OPT_VERBOSE,
+     /* equiv idx, value */ 33, VALUE_OPT_VERBOSE,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ VERBOSE_FLAGS, 0,
@@ -976,8 +998,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zVerboseText, zVerbose_NAME, zVerbose_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 33, VALUE_OPT_DECODE,
-     /* equiv idx, value */ 33, VALUE_OPT_DECODE,
+  {  /* entry idx, value */ 34, VALUE_OPT_DECODE,
+     /* equiv idx, value */ 34, VALUE_OPT_DECODE,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ DECODE_FLAGS, 0,
@@ -988,8 +1010,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zDecodeText, zDecode_NAME, zDecode_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 34, VALUE_OPT_VERSION,
-     /* equiv idx, value */ 34, VALUE_OPT_VERSION,
+  {  /* entry idx, value */ 35, VALUE_OPT_VERSION,
+     /* equiv idx, value */ 35, VALUE_OPT_VERSION,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ VERSION_FLAGS, 0,
@@ -1000,8 +1022,8 @@ static tOptDesc optDesc[ OPTION_CT ] = {
      /* desc, NAME, name */ zVersionText, zVersion_NAME, zVersion_Name,
      /* disablement strs */ NULL, NULL },
 
-  {  /* entry idx, value */ 35, VALUE_OPT_LESS_HELP,
-     /* equiv idx, value */ 35, VALUE_OPT_LESS_HELP,
+  {  /* entry idx, value */ 36, VALUE_OPT_LESS_HELP,
+     /* equiv idx, value */ 36, VALUE_OPT_LESS_HELP,
      /* equivalenced to  */ NO_EQUIVALENT,
      /* min, max, act ct */ 0, 1, 0,
      /* opt state flags  */ LESS_HELP_FLAGS, 0,
@@ -1128,7 +1150,7 @@ tOptions tcpbridgeOptions = {
       NO_EQUIVALENT /* index of '-#' option */,
       9 /* index of default opt */
     },
-    40 /* full option count */, 36 /* user option count */,
+    41 /* full option count */, 37 /* user option count */,
     tcpbridge_full_usage, tcpbridge_short_usage
 };
 
@@ -1528,7 +1550,7 @@ doOptVersion(
     fprintf(stderr, " (debug)");
 #endif
     fprintf(stderr, "\n");
-    fprintf(stderr, "Copyright 2001-2007 by Aaron Turner <aturner at synfin dot net>\n");
+    fprintf(stderr, "Copyright 2001-2008 by Aaron Turner <aturner at synfin dot net>\n");
 #ifdef HAVE_LIBNET
     fprintf(stderr, "Compiled against libnet: %s\n", LIBNET_VERSION);
 #else

+ 3 - 3
src/tcpbridge_opts.def

@@ -2,11 +2,11 @@ autogen definitions options;
 
 
 copyright = {
-    date        = "2005-2007";
+    date        = "2005-2008";
     owner       = "Aaron Turner";
     type        = "bsd";
     author      = <<- EOText
-Copyright 2000-2007 Aaron Turner
+Copyright 2000-2008 Aaron Turner
 
 For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
 
@@ -306,7 +306,7 @@ flag = {
     fprintf(stderr, " (debug)");
 #endif
     fprintf(stderr, "\n");
-    fprintf(stderr, "Copyright 2001-2007 by Aaron Turner <aturner at synfin dot net>\n");
+    fprintf(stderr, "Copyright 2001-2008 by Aaron Turner <aturner at synfin dot net>\n");
 #ifdef HAVE_LIBNET
     fprintf(stderr, "Compiled against libnet: %s\n", LIBNET_VERSION);
 #else

+ 47 - 45
src/tcpbridge_opts.h

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpbridge_opts.h)
  *  
- *  It has been AutoGen-ed  Wednesday January 16, 2008 at 10:09:46 PM PST
+ *  It has been AutoGen-ed  Thursday May 15, 2008 at 08:51:18 AM PDT
  *  From the definitions    tcpbridge_opts.def
  *  and the template file   options
  *
@@ -20,7 +20,7 @@
  *
  * This source file is copyrighted and licensed under the following terms:
  *
- * tcpbridge copyright 2005-2007 Aaron Turner - all rights reserved
+ * tcpbridge copyright 2005-2008 Aaron Turner - all rights reserved
  *
  * tcpbridge is free software copyrighted by Aaron Turner.
  * 
@@ -87,38 +87,39 @@ typedef enum {
         INDEX_OPT_FIXCSUM          =  8,
         INDEX_OPT_MTU              =  9,
         INDEX_OPT_EFCS             = 10,
-        INDEX_OPT_FIXLEN           = 11,
-        INDEX_OPT_SKIPL2BROADCAST  = 12,
-        INDEX_OPT_DLT              = 13,
-        INDEX_OPT_ENET_DMAC        = 14,
-        INDEX_OPT_ENET_SMAC        = 15,
-        INDEX_OPT_ENET_VLAN        = 16,
-        INDEX_OPT_ENET_VLAN_TAG    = 17,
-        INDEX_OPT_ENET_VLAN_CFI    = 18,
-        INDEX_OPT_ENET_VLAN_PRI    = 19,
-        INDEX_OPT_HDLC_CONTROL     = 20,
-        INDEX_OPT_HDLC_ADDRESS     = 21,
-        INDEX_OPT_USER_DLT         = 22,
-        INDEX_OPT_USER_DLINK       = 23,
-        INDEX_OPT_DBUG             = 24,
-        INDEX_OPT_INTF1            = 25,
-        INDEX_OPT_INTF2            = 26,
-        INDEX_OPT_UNIDIR           = 27,
-        INDEX_OPT_LIMIT            = 28,
-        INDEX_OPT_INCLUDE          = 29,
-        INDEX_OPT_EXCLUDE          = 30,
-        INDEX_OPT_PID              = 31,
-        INDEX_OPT_VERBOSE          = 32,
-        INDEX_OPT_DECODE           = 33,
-        INDEX_OPT_VERSION          = 34,
-        INDEX_OPT_LESS_HELP        = 35,
-        INDEX_OPT_HELP             = 36,
-        INDEX_OPT_MORE_HELP        = 37,
-        INDEX_OPT_SAVE_OPTS        = 38,
-        INDEX_OPT_LOAD_OPTS        = 39
+        INDEX_OPT_TTL              = 11,
+        INDEX_OPT_FIXLEN           = 12,
+        INDEX_OPT_SKIPL2BROADCAST  = 13,
+        INDEX_OPT_DLT              = 14,
+        INDEX_OPT_ENET_DMAC        = 15,
+        INDEX_OPT_ENET_SMAC        = 16,
+        INDEX_OPT_ENET_VLAN        = 17,
+        INDEX_OPT_ENET_VLAN_TAG    = 18,
+        INDEX_OPT_ENET_VLAN_CFI    = 19,
+        INDEX_OPT_ENET_VLAN_PRI    = 20,
+        INDEX_OPT_HDLC_CONTROL     = 21,
+        INDEX_OPT_HDLC_ADDRESS     = 22,
+        INDEX_OPT_USER_DLT         = 23,
+        INDEX_OPT_USER_DLINK       = 24,
+        INDEX_OPT_DBUG             = 25,
+        INDEX_OPT_INTF1            = 26,
+        INDEX_OPT_INTF2            = 27,
+        INDEX_OPT_UNIDIR           = 28,
+        INDEX_OPT_LIMIT            = 29,
+        INDEX_OPT_INCLUDE          = 30,
+        INDEX_OPT_EXCLUDE          = 31,
+        INDEX_OPT_PID              = 32,
+        INDEX_OPT_VERBOSE          = 33,
+        INDEX_OPT_DECODE           = 34,
+        INDEX_OPT_VERSION          = 35,
+        INDEX_OPT_LESS_HELP        = 36,
+        INDEX_OPT_HELP             = 37,
+        INDEX_OPT_MORE_HELP        = 38,
+        INDEX_OPT_SAVE_OPTS        = 39,
+        INDEX_OPT_LOAD_OPTS        = 40
 } teOptIndex;
 
-#define OPTION_CT    40
+#define OPTION_CT    41
 
 /*
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
@@ -158,25 +159,26 @@ typedef enum {
 #define VALUE_OPT_MTU            'm'
 #define OPT_VALUE_MTU            (DESC(MTU).optArg.argInt)
 #define VALUE_OPT_EFCS           'E'
+#define VALUE_OPT_TTL            11
 #define VALUE_OPT_FIXLEN         'F'
-#define VALUE_OPT_SKIPL2BROADCAST 12
-#define VALUE_OPT_DLT            13
-#define VALUE_OPT_ENET_DMAC      14
-#define VALUE_OPT_ENET_SMAC      15
-#define VALUE_OPT_ENET_VLAN      16
-#define VALUE_OPT_ENET_VLAN_TAG  17
+#define VALUE_OPT_SKIPL2BROADCAST 13
+#define VALUE_OPT_DLT            14
+#define VALUE_OPT_ENET_DMAC      15
+#define VALUE_OPT_ENET_SMAC      16
+#define VALUE_OPT_ENET_VLAN      17
+#define VALUE_OPT_ENET_VLAN_TAG  18
 #define OPT_VALUE_ENET_VLAN_TAG  (DESC(ENET_VLAN_TAG).optArg.argInt)
-#define VALUE_OPT_ENET_VLAN_CFI  18
+#define VALUE_OPT_ENET_VLAN_CFI  19
 #define OPT_VALUE_ENET_VLAN_CFI  (DESC(ENET_VLAN_CFI).optArg.argInt)
-#define VALUE_OPT_ENET_VLAN_PRI  19
+#define VALUE_OPT_ENET_VLAN_PRI  20
 #define OPT_VALUE_ENET_VLAN_PRI  (DESC(ENET_VLAN_PRI).optArg.argInt)
-#define VALUE_OPT_HDLC_CONTROL   20
+#define VALUE_OPT_HDLC_CONTROL   21
 #define OPT_VALUE_HDLC_CONTROL   (DESC(HDLC_CONTROL).optArg.argInt)
-#define VALUE_OPT_HDLC_ADDRESS   21
+#define VALUE_OPT_HDLC_ADDRESS   22
 #define OPT_VALUE_HDLC_ADDRESS   (DESC(HDLC_ADDRESS).optArg.argInt)
-#define VALUE_OPT_USER_DLT       22
+#define VALUE_OPT_USER_DLT       23
 #define OPT_VALUE_USER_DLT       (DESC(USER_DLT).optArg.argInt)
-#define VALUE_OPT_USER_DLINK     23
+#define VALUE_OPT_USER_DLINK     24
 #ifdef DEBUG
 #define VALUE_OPT_DBUG           'd'
 #define OPT_VALUE_DBUG           (DESC(DBUG).optArg.argInt)
@@ -192,7 +194,7 @@ typedef enum {
 #ifdef ENABLE_VERBOSE
 #define VALUE_OPT_VERBOSE        'v'
 #define SET_OPT_VERBOSE   STMTS( \
-        DESC(VERBOSE).optActualIndex = 32; \
+        DESC(VERBOSE).optActualIndex = 33; \
         DESC(VERBOSE).optActualValue = VALUE_OPT_VERBOSE; \
         DESC(VERBOSE).fOptState &= OPTST_PERSISTENT_MASK; \
         DESC(VERBOSE).fOptState |= OPTST_SET )

BIN
src/tcpedit/._dlt.c


BIN
src/tcpedit/._tcpedit.c


+ 16 - 10
src/tcpedit/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -142,7 +142,7 @@ am_libtcpedit_a_OBJECTS = tcpedit.$(OBJEXT) parse_args.$(OBJEXT) \
 	linuxsll.$(OBJEXT) ieee80211.$(OBJEXT) ieee80211_hdr.$(OBJEXT) \
 	radiotap.$(OBJEXT)
 libtcpedit_a_OBJECTS = $(am_libtcpedit_a_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -173,6 +173,7 @@ CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CUT = @CUT@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
@@ -180,6 +181,8 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DMALLOC_LIB = @DMALLOC_LIB@
+DSYMUTIL = @DSYMUTIL@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -195,6 +198,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LDFLAGS = @LDFLAGS@
+LDNETINC = @LDNETINC@
+LDNETLIB = @LDNETLIB@
 LIBOBJS = @LIBOBJS@
 LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
 LIBOPTS_DIR = @LIBOPTS_DIR@
@@ -212,6 +217,7 @@ LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -288,6 +294,7 @@ target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
 tcpdump_path = @tcpdump_path@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 noinst_LIBRARIES = libtcpedit.a
@@ -653,8 +660,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -666,8 +673,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { 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) \
@@ -677,13 +684,12 @@ 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; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

+ 40 - 1
src/tcpedit/edit_packet.c

@@ -1,4 +1,4 @@
-/* $Id: edit_packet.c 1895 2007-08-22 04:24:33Z aturner $ */
+/* $Id: edit_packet.c 1983 2008-04-25 04:51:07Z aturner $ */
 
 /*
  * Copyright (c) 2001-2007 Aaron Turner.
@@ -295,6 +295,45 @@ extract_data(tcpedit_t *tcpedit, const u_char *pktdata, int caplen,
 }
 
 /**
+ * rewrites an IPv4 packet's TTL based on the rules
+ * return 0 if no change, 1 if changed 
+ */
+int
+rewrite_ipv4_ttl(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr)
+{
+    assert(tcpedit);
+
+    /* make sure there's something to edit */
+    if (ip_hdr == NULL || tcpedit->ttl_mode == TCPEDIT_TTL_OFF)
+        return(0);
+        
+    switch(tcpedit->ttl_mode) {
+    case TCPEDIT_TTL_SET:
+        if (ip_hdr->ip_ttl == tcpedit->ttl_value)
+            return(0);           /* no change required */
+        ip_hdr->ip_ttl = tcpedit->ttl_value;
+        break;
+    case TCPEDIT_TTL_ADD:
+        if (((int)ip_hdr->ip_ttl + tcpedit->ttl_value) > 255) {
+            ip_hdr->ip_ttl = 255;
+        } else {
+            ip_hdr->ip_ttl += tcpedit->ttl_value;
+        }
+        break;
+    case TCPEDIT_TTL_SUB:
+        if (ip_hdr->ip_ttl <= tcpedit->ttl_value) {
+            ip_hdr->ip_ttl = 1;
+        } else {
+            ip_hdr->ip_ttl -= tcpedit->ttl_value;
+        }
+        break;
+    default:
+        errx(1, "invalid ttl_mode: %d", tcpedit->ttl_mode);
+    }
+    return(1);
+}
+
+/**
  * takes a CIDR notation netblock and uses that to "remap" given IP
  * onto that netblock.  ie: 10.0.0.0/8 and 192.168.55.123 -> 10.168.55.123
  * while 10.150.9.0/24 and 192.168.55.123 -> 10.150.9.123

+ 3 - 1
src/tcpedit/edit_packet.h

@@ -1,4 +1,4 @@
-/* $Id: edit_packet.h 1757 2007-03-22 05:38:56Z aturner $ */
+/* $Id: edit_packet.h 1983 2008-04-25 04:51:07Z aturner $ */
 
 /*
  * Copyright (c) 2001-2004 Aaron Turner.
@@ -55,6 +55,8 @@ int rewrite_ipv4l3(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr, tcpr_dir_t direction)
 
 int rewrite_iparp(tcpedit_t *tcpedit, arp_hdr_t *arp_hdr, int direction);
 
+int rewrite_ipv4_ttl(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr);
+
 #define BROADCAST_IP 4294967295
 
 #endif

+ 22 - 4
src/tcpedit/parse_args.c

@@ -1,4 +1,4 @@
-/* $Id: parse_args.c 1895 2007-08-22 04:24:33Z aturner $ */
+/* $Id: parse_args.c 1983 2008-04-25 04:51:07Z aturner $ */
 
 /*
  * Copyright (c) 2006 Aaron Turner.
@@ -51,7 +51,7 @@ int
 tcpedit_post_args(tcpedit_t **tcpedit_ex) {
     tcpedit_t *tcpedit;
     int rcode = 0;
-
+    long ttl;
     assert(tcpedit_ex);
     tcpedit = *tcpedit_ex;
     assert(tcpedit);
@@ -116,11 +116,29 @@ tcpedit_post_args(tcpedit_t **tcpedit_ex) {
     if (HAVE_OPT(FIXCSUM))
         tcpedit->fixcsum = 1;
 
-#ifdef ENABLE_EFCS
     /* --efcs */
     if (HAVE_OPT(EFCS)) 
         tcpedit->efcs = 1;
-#endif
+
+    /* --ttl */
+    if (HAVE_OPT(TTL)) {
+        if (strchr(OPT_ARG(TTL), '+')) {
+            tcpedit->ttl_mode = TCPEDIT_TTL_ADD;            
+        } else if (strchr(OPT_ARG(TTL), '-')) {
+            tcpedit->ttl_mode = TCPEDIT_TTL_SUB;            
+        } else {
+            tcpedit->ttl_mode = TCPEDIT_TTL_SET;            
+        }
+
+        ttl = strtol(OPT_ARG(TTL), (char **)NULL, 10);
+        if (ttl < 0)
+            ttl *= -1; /* convert to positive value */
+            
+        if (ttl > 255)
+            errx(1, "Invalid --ttl value (must be 0-255): %ld", ttl);
+
+        tcpedit->ttl_value = (u_int8_t)ttl;
+    }
 
     /* --mtu */
     if (HAVE_OPT(MTU))

BIN
src/tcpedit/plugins/._dlt_plugins.c


BIN
src/tcpedit/plugins/._dlt_plugins.h


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

@@ -1,4 +1,4 @@
-/* $Id: en10mb.c 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: en10mb.c 1916 2007-10-24 16:43:03Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.

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

@@ -1,4 +1,4 @@
-/* $Id: hdlc.c 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: hdlc.c 1911 2007-10-23 21:53:34Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.

+ 1 - 1
src/tcpedit/plugins/dlt_ieee80211/ieee80211.c

@@ -1,4 +1,4 @@
-/* $Id: ieee80211.c 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: ieee80211.c 1911 2007-10-23 21:53:34Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.

+ 5 - 3
src/tcpedit/plugins/dlt_ieee80211/ieee80211.h

@@ -1,4 +1,4 @@
-/* $Id: ieee80211.h 1841 2007-04-26 03:43:14Z aturner $ */
+/* $Id: ieee80211.h 1963 2008-01-23 18:21:40Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -93,7 +93,8 @@ typedef struct ieee80211_addr4_hdr_s ieee80211_addr4_hdr_t;
  * Example: Ethernet VLAN tag info
  */
 struct ieee80211_extra_s {
-
+    /* dummy entry for SunPro compiler which doesn't like empty structs */    
+    int dummy;
 };
 typedef struct ieee80211_extra_s ieee80211_extra_t;
 
@@ -108,7 +109,8 @@ typedef struct ieee80211_extra_s ieee80211_extra_t;
  *   is available to any encoder plugin.
  */
 struct ieee80211_config_s {
-    
+    /* dummy entry for SunPro compiler which doesn't like empty structs */    
+    int dummy;
 };
 typedef struct ieee80211_config_s ieee80211_config_t;
 

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

@@ -1,4 +1,4 @@
-/* $Id: linuxsll.c 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: linuxsll.c 1911 2007-10-23 21:53:34Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.

+ 5 - 4
src/tcpedit/plugins/dlt_linuxsll/linuxsll.h

@@ -1,4 +1,4 @@
-/* $Id: linuxsll.h 1841 2007-04-26 03:43:14Z aturner $ */
+/* $Id: linuxsll.h 1963 2008-01-23 18:21:40Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -54,7 +54,7 @@ u_char *dlt_linuxsll_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const
  * Example: Ethernet VLAN tag info
  */
 struct linuxsll_extra_s {
-
+    int dummy;
 };
 typedef struct linuxsll_extra_s linuxsll_extra_t;
 
@@ -68,8 +68,9 @@ typedef struct linuxsll_extra_s linuxsll_extra_t;
  *   "extra" data parsed from the packet in the tcpeditdlt_t->decoded_extra buffer since that 
  *   is available to any encoder plugin.
  */
-struct linuxsll_config_s {
-    
+struct linuxsll_config_s {    
+    /* dummy entry for SunPro compiler which doesn't like empty structs */
+    int dummy;
 };
 typedef struct linuxsll_config_s linuxsll_config_t;
 

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

@@ -1,4 +1,4 @@
-/* $Id: null.c 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: null.c 1911 2007-10-23 21:53:34Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.

+ 5 - 3
src/tcpedit/plugins/dlt_null/null.h

@@ -1,4 +1,4 @@
-/* $Id: null.h 1841 2007-04-26 03:43:14Z aturner $ */
+/* $Id: null.h 1963 2008-01-23 18:21:40Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -54,7 +54,8 @@ u_char *dlt_null_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const u_c
  * Example: Ethernet VLAN tag info
  */
 struct null_extra_s {
-
+    /* dummy entry for SunPro compiler which doesn't like empty structs */
+    int dummy;
 };
 typedef struct null_extra_s null_extra_t;
 
@@ -69,7 +70,8 @@ typedef struct null_extra_s null_extra_t;
  *   is available to any encoder plugin.
  */
 struct null_config_s {
-    
+    /* dummy entry for SunPro compiler which doesn't like empty structs */
+    int dummy;
 };
 typedef struct null_config_s null_config_t;
 

+ 3 - 1
src/tcpedit/plugins/dlt_plugins.c

@@ -1,4 +1,4 @@
-/* $Id: dlt_plugins.c 1893 2007-08-10 04:24:50Z aturner $ */
+/* $Id: dlt_plugins.c 1963 2008-01-23 18:21:40Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -30,6 +30,8 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 
 #include "dlt_plugins-int.h"

+ 3 - 2
src/tcpedit/plugins/dlt_radiotap/radiotap.h

@@ -1,4 +1,4 @@
-/* $Id: radiotap.h 1869 2007-05-12 19:53:15Z aturner $ */
+/* $Id: radiotap.h 1963 2008-01-23 18:21:40Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -70,7 +70,8 @@ typedef struct radiotap_extra_s radiotap_extra_t;
  *   is available to any encoder plugin.
  */
 struct radiotap_config_s {
-    
+    /* dummy entry for SunPro compiler which doesn't like empty structs */    
+    int dummy;
 };
 typedef struct radiotap_config_s radiotap_config_t;
 

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

@@ -1,4 +1,4 @@
-/* $Id: raw.c 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: raw.c 1911 2007-10-23 21:53:34Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.

+ 5 - 3
src/tcpedit/plugins/dlt_raw/raw.h

@@ -1,4 +1,4 @@
-/* $Id: raw.h 1841 2007-04-26 03:43:14Z aturner $ */
+/* $Id: raw.h 1963 2008-01-23 18:21:40Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -54,7 +54,8 @@ u_char *dlt_raw_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t mac, const u_ch
  * Example: Ethernet VLAN tag info
  */
 struct raw_extra_s {
-
+    /* dummy entry for SunPro compiler which doesn't like empty structs */    
+    int dummy;
 };
 typedef struct raw_extra_s raw_extra_t;
 
@@ -69,7 +70,8 @@ typedef struct raw_extra_s raw_extra_t;
  *   is available to any encoder plugin.
  */
 struct raw_config_s {
-    
+    /* dummy entry for SunPro compiler which doesn't like empty structs */    
+    int dummy;
 };
 typedef struct raw_config_s raw_config_t;
 

+ 3 - 2
src/tcpedit/plugins/dlt_user/user.h

@@ -1,4 +1,4 @@
-/* $Id: user.h 1841 2007-04-26 03:43:14Z aturner $ */
+/* $Id: user.h 1963 2008-01-23 18:21:40Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -58,7 +58,8 @@ u_int16_t dlt_user_get_output_dlt(tcpeditdlt_t *ctx);
  * Example: Ethernet VLAN tag info
  */
 struct user_extra_s {
-    /* nothing here, b/c no decoder */
+    /* dummy entry for SunPro compiler which doesn't like empty structs */
+    int dummy; 
 };
 typedef struct user_extra_s user_extra_t;
 

+ 10 - 3
src/tcpedit/tcpedit-int.h

@@ -1,4 +1,4 @@
-/* $Id: tcpedit-int.h 1873 2007-07-10 03:51:46Z aturner $ */
+/* $Id: tcpedit-int.h 1983 2008-04-25 04:51:07Z aturner $ */
 
 /*
  * Copyright (c) 2006-2007 Aaron Turner.
@@ -96,15 +96,22 @@ struct tcpedit_s {
 #define TCPEDIT_REWRITE_IP_ON  0x1
     
     /* fix IP/TCP/UDP checksums */
-    int fixcsum;
+    u_int8_t fixcsum;
 #define TCPEDIT_FIXCSUM_OFF 0x0
 #define TCPEDIT_FIXCSUM_ON  0x1
 
     /* remove ethernet FCS */
-    int efcs;
+    u_int8_t efcs;
 #define TCPEDIT_EFCS_OFF 0x0
 #define TCPEDIT_EFCS_ON  0x1
 
+    u_int8_t ttl_mode;
+#define TCPEDIT_TTL_OFF 0x0
+#define TCPEDIT_TTL_SET 0x1
+#define TCPEDIT_TTL_ADD 0x2
+#define TCPEDIT_TTL_SUB 0x3
+    u_int8_t ttl_value;
+    
     /* rewrite end-point IP addresses between cidrmap1 & cidrmap2 */
     tcpr_cidrmap_t *cidrmap1;       /* tcpprep cache data */
     tcpr_cidrmap_t *cidrmap2;

+ 8 - 3
src/tcpedit/tcpedit.c

@@ -1,4 +1,4 @@
-/* $Id: tcpedit.c 1921 2007-10-25 18:18:50Z aturner $ */
+/* $Id: tcpedit.c 1983 2008-04-25 04:51:07Z aturner $ */
 
 /*
  * Copyright (c) 2001-2007 Aaron Turner.
@@ -108,8 +108,10 @@ tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr,
      * only set this flag IFF the pcap has the FCS.  If not, then they
      * just removed 2 bytes of ACTUAL PACKET DATA.  Sucks to be them.
      */
-    if (tcpedit->efcs)
-        (*pkthdr)->caplen -= 2;
+    if (tcpedit->efcs > 0) {
+        (*pkthdr)->caplen -= 4;
+        (*pkthdr)->len -= 4;
+    }
         
     /* rewrite DLT */
     if ((pktlen = tcpedit_dlt_process(tcpedit->dlt_ctx, *pktdata, (*pkthdr)->caplen, direction)) == TCPEDIT_ERROR)
@@ -143,6 +145,9 @@ tcpedit_packet(tcpedit_t *tcpedit, struct pcap_pkthdr **pkthdr,
         ip_hdr = NULL;
     }
 
+    /* rewrite the TTL */
+    needtorecalc += rewrite_ipv4_ttl(tcpedit, ip_hdr);
+    
     /* rewrite IP addresses */
     if (tcpedit->rewrite_ip) {
         /* IP packets */

+ 17 - 0
src/tcpedit/tcpedit_opts.def

@@ -153,6 +153,23 @@ EOText;
 };
 
 flag = {
+    name        = ttl;
+    descrip     = "Modify the IPv4 TTL";
+    arg-type    = string;
+    doc         = <<- EOText
+Allows you to modify the TTL of all the IPv4 packets.  Specify a number to hard-code
+the value or +/-value to increase or decrease by the value provided (limited to 1-255).    
+
+Examples:
+@example
+--ttl=10
+--ttl=+7
+--ttl=-64
+@end example
+EOText;
+};
+
+flag = {
     name        = fixlen;
     value       = F;
     arg-type    = string;

+ 29 - 27
src/tcpedit/tcpedit_stub.h

@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (tcpedit_stub.h)
  *  
- *  It has been AutoGen-ed  Wednesday January 16, 2008 at 10:09:48 PM PST
+ *  It has been AutoGen-ed  Thursday May 15, 2008 at 08:51:05 AM PDT
  *  From the definitions    tcpedit_stub.def
  *  and the template file   options
  *
@@ -42,23 +42,24 @@ typedef enum {
         INDEX_OPT_FIXCSUM          =  8,
         INDEX_OPT_MTU              =  9,
         INDEX_OPT_EFCS             = 10,
-        INDEX_OPT_FIXLEN           = 11,
-        INDEX_OPT_SKIPL2BROADCAST  = 12,
-        INDEX_OPT_DLT              = 13,
-        INDEX_OPT_ENET_DMAC        = 14,
-        INDEX_OPT_ENET_SMAC        = 15,
-        INDEX_OPT_ENET_VLAN        = 16,
-        INDEX_OPT_ENET_VLAN_TAG    = 17,
-        INDEX_OPT_ENET_VLAN_CFI    = 18,
-        INDEX_OPT_ENET_VLAN_PRI    = 19,
-        INDEX_OPT_HDLC_CONTROL     = 20,
-        INDEX_OPT_HDLC_ADDRESS     = 21,
-        INDEX_OPT_USER_DLT         = 22,
-        INDEX_OPT_USER_DLINK       = 23,
+        INDEX_OPT_TTL              = 11,
+        INDEX_OPT_FIXLEN           = 12,
+        INDEX_OPT_SKIPL2BROADCAST  = 13,
+        INDEX_OPT_DLT              = 14,
+        INDEX_OPT_ENET_DMAC        = 15,
+        INDEX_OPT_ENET_SMAC        = 16,
+        INDEX_OPT_ENET_VLAN        = 17,
+        INDEX_OPT_ENET_VLAN_TAG    = 18,
+        INDEX_OPT_ENET_VLAN_CFI    = 19,
+        INDEX_OPT_ENET_VLAN_PRI    = 20,
+        INDEX_OPT_HDLC_CONTROL     = 21,
+        INDEX_OPT_HDLC_ADDRESS     = 22,
+        INDEX_OPT_USER_DLT         = 23,
+        INDEX_OPT_USER_DLINK       = 24,
         LIBRARY_OPTION_COUNT
 } teOptIndex;
 
-#define OPTION_CT    24
+#define OPTION_CT    25
 
 /*
  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
@@ -99,25 +100,26 @@ extern tOptDesc * const tcpedit_tcpedit_optDesc_p;
 #define VALUE_OPT_MTU            'm'
 #define OPT_VALUE_MTU            (DESC(MTU).optArg.argInt)
 #define VALUE_OPT_EFCS           'E'
+#define VALUE_OPT_TTL            11
 #define VALUE_OPT_FIXLEN         'F'
-#define VALUE_OPT_SKIPL2BROADCAST 12
-#define VALUE_OPT_DLT            13
-#define VALUE_OPT_ENET_DMAC      14
-#define VALUE_OPT_ENET_SMAC      15
-#define VALUE_OPT_ENET_VLAN      16
-#define VALUE_OPT_ENET_VLAN_TAG  17
+#define VALUE_OPT_SKIPL2BROADCAST 13
+#define VALUE_OPT_DLT            14
+#define VALUE_OPT_ENET_DMAC      15
+#define VALUE_OPT_ENET_SMAC      16
+#define VALUE_OPT_ENET_VLAN      17
+#define VALUE_OPT_ENET_VLAN_TAG  18
 #define OPT_VALUE_ENET_VLAN_TAG  (DESC(ENET_VLAN_TAG).optArg.argInt)
-#define VALUE_OPT_ENET_VLAN_CFI  18
+#define VALUE_OPT_ENET_VLAN_CFI  19
 #define OPT_VALUE_ENET_VLAN_CFI  (DESC(ENET_VLAN_CFI).optArg.argInt)
-#define VALUE_OPT_ENET_VLAN_PRI  19
+#define VALUE_OPT_ENET_VLAN_PRI  20
 #define OPT_VALUE_ENET_VLAN_PRI  (DESC(ENET_VLAN_PRI).optArg.argInt)
-#define VALUE_OPT_HDLC_CONTROL   20
+#define VALUE_OPT_HDLC_CONTROL   21
 #define OPT_VALUE_HDLC_CONTROL   (DESC(HDLC_CONTROL).optArg.argInt)
-#define VALUE_OPT_HDLC_ADDRESS   21
+#define VALUE_OPT_HDLC_ADDRESS   22
 #define OPT_VALUE_HDLC_ADDRESS   (DESC(HDLC_ADDRESS).optArg.argInt)
-#define VALUE_OPT_USER_DLT       22
+#define VALUE_OPT_USER_DLT       23
 #define OPT_VALUE_USER_DLT       (DESC(USER_DLT).optArg.argInt)
-#define VALUE_OPT_USER_DLINK     23
+#define VALUE_OPT_USER_DLINK     24
 
 #define VALUE_OPT_HELP          '?'
 #define VALUE_OPT_MORE_HELP     '!'

+ 14 - 4
src/tcpprep.1

@@ -1,7 +1,7 @@
-.TH TCPPREP 1 2008-01-16 "(tcpprep )" "Programmer's Manual"
+.TH TCPPREP 1 2008-05-15 "(tcpprep )" "Programmer's Manual"
 .\"  DO NOT EDIT THIS FILE   (tcpprep.1)
 .\"  
-.\"  It has been AutoGen-ed  Wednesday January 16, 2008 at 10:09:47 PM PST
+.\"  It has been AutoGen-ed  Thursday May 15, 2008 at 08:51:21 AM PDT
 .\"  From the definitions    tcpprep_opts.def
 .\"  and the template file   agman1.tpl
 .\"
@@ -126,6 +126,15 @@ Specify a list of MAC addresses to match against the source MAC
 of each packet.  Packets matching one of the values are classified
 as servers.	
 .TP
+.BR \--reverse
+Matches to be client instead of server.
+This option may appear up to 1 times.
+.sp
+Normally the \fB--mac\fP, \fB--regex\fP and \fB--cidr\fP flags specify are used to specify
+the servers and non-IP packets are classified as clients.  By using \fB--reverse\fP, these  
+features are reversed so that the flags specify clients and non-IP packets are classified as
+servers.
+.TP
 .BR \-C " \fIstring\fP, " \--comment "=" \fIstring\fP
 Embeded cache file comment.
 This option may appear up to 1 times.
@@ -256,7 +265,8 @@ This option may appear up to 1 times.
 .sp
 By default, non-IP traffic which can not be classified as client
 or server is classified as "client".  Specifiying \fB--nonip\fP
-will reclassify non-IP traffic as "server".
+will reclassify non-IP traffic as "server".  Note that the meaning
+of this flag is reversed if \fB--reverse\fP is used.
 .TP
 .BR \-R " \fIstring\fP, " \--ratio "=" \fIstring\fP
 Ratio of client to server packets.
@@ -371,7 +381,7 @@ is searched for within that directory.
 .SH "SEE ALSO"
 tcpdump(1), tcprewrite(1), tcpreplay(1)
 .SH AUTHOR
-Copyright 2000-2007 Aaron Turner
+Copyright 2000-2008 Aaron Turner
 
 For support please use the tcpreplay-users@lists.sourceforge.net mailing list.
 

+ 0 - 0
src/tcpprep.c


Some files were not shown because too many files changed in this diff