[Snort-devel] submission of patch to create an option (-B) to turn on "flush write buffer on newline" in snort

Holt Sorenson hso at ...455...
Wed Jun 6 22:39:56 EDT 2001


Please merge this with the snort source if it meets with your
approval and seems reasonable.

This patch (see attached) can be successfully applied to snort-1.7 with
patch -p1 < patch_file after cding into the untar'd source directory.

One can then ./configure <with appropriate options>;make;make install
and the switch will be available.

This patch modifies the following files:
Makefile.in
config.h.in
configure
configure.in
snort.8
snort.c

Inspiration for this comes from tcpdump's -l option.

I maintain a text sniffer output beautifier (snifob) for which
having this option available is useful.

Thanks!

--
Holt Sorenson
hso at ...455...

-------------- next part --------------
diff -cr snort-1.7.orig/Makefile.in snort-1.7.buffered.option/Makefile.in
*** snort-1.7.orig/Makefile.in	Fri Jan  5 19:22:47 2001
--- snort-1.7.buffered.option/Makefile.in	Mon May 21 23:05:04 2001
***************
*** 326,332 ****
  	@for file in $(DISTFILES); do \
  	  d=$(srcdir); \
  	  if test -d $$d/$$file; then \
! 	    cp -pr $$/$$file $(distdir)/$$file; \
  	  else \
  	    test -f $(distdir)/$$file \
  	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
--- 326,332 ----
  	@for file in $(DISTFILES); do \
  	  d=$(srcdir); \
  	  if test -d $$d/$$file; then \
! 	    cp -pr $$d/$$file $(distdir)/$$file; \
  	  else \
  	    test -f $(distdir)/$$file \
  	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
diff -cr snort-1.7.orig/config.h.in snort-1.7.buffered.option/config.h.in
*** snort-1.7.orig/config.h.in	Fri Jan  5 19:22:09 2001
--- snort-1.7.buffered.option/config.h.in	Mon May 21 23:05:52 2001
***************
*** 60,65 ****
--- 60,68 ----
  #undef NEED_DECL_STRTOUL
  #undef ERRLIST_PREDEFINED
  
+ /* Define if you have the setlinebuf function.  */
+ #undef HAVE_SETLINEBUF
+ 
  /* Define if you have the snprintf function.  */
  #undef HAVE_SNPRINTF
  
diff -cr snort-1.7.orig/configure snort-1.7.buffered.option/configure
*** snort-1.7.orig/configure	Fri Jan  5 19:22:49 2001
--- snort-1.7.buffered.option/configure	Mon May 21 23:05:04 2001
***************
*** 2288,2296 ****
  fi
  done
  
  
  cat > conftest.$ac_ext <<EOF
! #line 2294 "configure"
  #include "confdefs.h"
  
  #include <stdio.h>
--- 2288,2351 ----
  fi
  done
  
+ for ac_func in setlinebuf
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:2295: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 2300 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+ #include <assert.h>
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char $ac_func();
+ 
+ int main() {
+ 
+ /* The GNU C library defines this for functions which it implements
+     to always fail with ENOSYS.  Some functions are actually named
+     something starting with __ and the normal name is an alias.  */
+ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ $ac_func();
+ #endif
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:2323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=no"
+ fi
+ rm -f conftest*
+ fi
+ 
+ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_func 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ done
+ 
  
  cat > conftest.$ac_ext <<EOF
! #line 2349 "configure"
  #include "confdefs.h"
  
  #include <stdio.h>
***************
*** 2299,2305 ****
  char *foo; foo = sys_errlist[0];
  ; return 0; }
  EOF
! if { (eval echo configure:2303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define ERRLIST_PREDEFINED 1
--- 2354,2360 ----
  char *foo; foo = sys_errlist[0];
  ; return 0; }
  EOF
! if { (eval echo configure:2358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define ERRLIST_PREDEFINED 1
***************
*** 2339,2345 ****
  fi
  
  echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
! echo "configure:2343: checking for floor in -lm" >&5
  ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2394,2400 ----
  fi
  
  echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
! echo "configure:2398: checking for floor in -lm" >&5
  ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2347,2353 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lm  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2351 "configure"
  #include "confdefs.h"
  /* Override any gcc2 internal prototype to avoid an error.  */
  /* We use char because int might match the return type of a gcc2
--- 2402,2408 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lm  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2406 "configure"
  #include "confdefs.h"
  /* Override any gcc2 internal prototype to avoid an error.  */
  /* We use char because int might match the return type of a gcc2
***************
*** 2358,2364 ****
  floor()
  ; return 0; }
  EOF
! if { (eval echo configure:2362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2413,2419 ----
  floor()
  ; return 0; }
  EOF
! if { (eval echo configure:2417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2388,2394 ****
  
  LPCAP=""
  echo $ac_n "checking for pcap_datalink in -lpcap""... $ac_c" 1>&6
! echo "configure:2392: checking for pcap_datalink in -lpcap" >&5
  ac_lib_var=`echo pcap'_'pcap_datalink | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 2443,2449 ----
  
  LPCAP=""
  echo $ac_n "checking for pcap_datalink in -lpcap""... $ac_c" 1>&6
! echo "configure:2447: checking for pcap_datalink in -lpcap" >&5
  ac_lib_var=`echo pcap'_'pcap_datalink | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 2396,2402 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lpcap  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2400 "configure"
  #include "confdefs.h"
  /* Override any gcc2 internal prototype to avoid an error.  */
  /* We use char because int might match the return type of a gcc2
--- 2451,2457 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lpcap  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 2455 "configure"
  #include "confdefs.h"
  /* Override any gcc2 internal prototype to avoid an error.  */
  /* We use char because int might match the return type of a gcc2
***************
*** 2407,2413 ****
  pcap_datalink()
  ; return 0; }
  EOF
! if { (eval echo configure:2411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 2462,2468 ----
  pcap_datalink()
  ; return 0; }
  EOF
! if { (eval echo configure:2466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 2466,2472 ****
    fi
  
    echo $ac_n "checking "for mysql"""... $ac_c" 1>&6
! echo "configure:2470: checking "for mysql"" >&5
  
    for i in $mysql_directory; do
      if test -r $i/include/mysql/mysql.h; then
--- 2521,2527 ----
    fi
  
    echo $ac_n "checking "for mysql"""... $ac_c" 1>&6
! echo "configure:2525: checking "for mysql"" >&5
  
    for i in $mysql_directory; do
      if test -r $i/include/mysql/mysql.h; then
***************
*** 2556,2562 ****
    fi
  
    echo $ac_n "checking "for odbc"""... $ac_c" 1>&6
! echo "configure:2560: checking "for odbc"" >&5
  
    for i in $odbc_directory; do
      if test -r $i/include/sql.h; then
--- 2611,2617 ----
    fi
  
    echo $ac_n "checking "for odbc"""... $ac_c" 1>&6
! echo "configure:2615: checking "for odbc"" >&5
  
    for i in $odbc_directory; do
      if test -r $i/include/sql.h; then
***************
*** 2646,2652 ****
    fi
  
    echo $ac_n "checking "for postgresql"""... $ac_c" 1>&6
! echo "configure:2650: checking "for postgresql"" >&5
  
    for i in $postgresql_directory; do
      if test -r $i/include/pgsql/libpq-fe.h; then
--- 2701,2707 ----
    fi
  
    echo $ac_n "checking "for postgresql"""... $ac_c" 1>&6
! echo "configure:2705: checking "for postgresql"" >&5
  
    for i in $postgresql_directory; do
      if test -r $i/include/pgsql/libpq-fe.h; then
***************
*** 2739,2745 ****
    fi
  
    echo $ac_n "checking "for oracle"""... $ac_c" 1>&6
! echo "configure:2743: checking "for oracle"" >&5
  
    for i in $oracle_directory; do
      if test -r $i/rdbms/demo/oci.h; then
--- 2794,2800 ----
    fi
  
    echo $ac_n "checking "for oracle"""... $ac_c" 1>&6
! echo "configure:2798: checking "for oracle"" >&5
  
    for i in $oracle_directory; do
      if test -r $i/rdbms/demo/oci.h; then
***************
*** 2803,2809 ****
    fi
  
    echo $ac_n "checking "for openssl"""... $ac_c" 1>&6
! echo "configure:2807: checking "for openssl"" >&5
  
    for i in $openssl_directory; do
      if test -r $i/include/openssl/crypto.h; then
--- 2858,2864 ----
    fi
  
    echo $ac_n "checking "for openssl"""... $ac_c" 1>&6
! echo "configure:2862: checking "for openssl"" >&5
  
    for i in $openssl_directory; do
      if test -r $i/include/openssl/crypto.h; then
***************
*** 2897,2903 ****
  	if test "$enable_flexresp" = "yes"; then
  		LIBNET_INC_DIR=""
    		echo $ac_n "checking "for libnet.h"""... $ac_c" 1>&6
! echo "configure:2901: checking "for libnet.h"" >&5
  		libnet_dir="/usr/include /usr/local/include" 
  		for i in $libnet_dir; do
      			if test -r $i/libnet.h; then
--- 2952,2958 ----
  	if test "$enable_flexresp" = "yes"; then
  		LIBNET_INC_DIR=""
    		echo $ac_n "checking "for libnet.h"""... $ac_c" 1>&6
! echo "configure:2956: checking "for libnet.h"" >&5
  		libnet_dir="/usr/include /usr/local/include" 
  		for i in $libnet_dir; do
      			if test -r $i/libnet.h; then
***************
*** 2925,2936 ****
  
  if test "$tru64_types" = "yes"; then
          echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
! echo "configure:2929: checking for ANSI C header files" >&5
  if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2934 "configure"
  #include "confdefs.h"
  #include <stdlib.h>
  #include <stdarg.h>
--- 2980,2991 ----
  
  if test "$tru64_types" = "yes"; then
          echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
! echo "configure:2984: checking for ANSI C header files" >&5
  if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 2989 "configure"
  #include "confdefs.h"
  #include <stdlib.h>
  #include <stdarg.h>
***************
*** 2938,2944 ****
  #include <float.h>
  EOF
  ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
! { (eval echo configure:2942: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  if test -z "$ac_err"; then
    rm -rf conftest*
--- 2993,2999 ----
  #include <float.h>
  EOF
  ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
! { (eval echo configure:2997: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  if test -z "$ac_err"; then
    rm -rf conftest*
***************
*** 2955,2961 ****
  if test $ac_cv_header_stdc = yes; then
    # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  cat > conftest.$ac_ext <<EOF
! #line 2959 "configure"
  #include "confdefs.h"
  #include <string.h>
  EOF
--- 3010,3016 ----
  if test $ac_cv_header_stdc = yes; then
    # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  cat > conftest.$ac_ext <<EOF
! #line 3014 "configure"
  #include "confdefs.h"
  #include <string.h>
  EOF
***************
*** 2973,2979 ****
  if test $ac_cv_header_stdc = yes; then
    # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
  cat > conftest.$ac_ext <<EOF
! #line 2977 "configure"
  #include "confdefs.h"
  #include <stdlib.h>
  EOF
--- 3028,3034 ----
  if test $ac_cv_header_stdc = yes; then
    # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
  cat > conftest.$ac_ext <<EOF
! #line 3032 "configure"
  #include "confdefs.h"
  #include <stdlib.h>
  EOF
***************
*** 2994,3000 ****
    :
  else
    cat > conftest.$ac_ext <<EOF
! #line 2998 "configure"
  #include "confdefs.h"
  #include <ctype.h>
  #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
--- 3049,3055 ----
    :
  else
    cat > conftest.$ac_ext <<EOF
! #line 3053 "configure"
  #include "confdefs.h"
  #include <ctype.h>
  #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
***************
*** 3005,3011 ****
  exit (0); }
  
  EOF
! if { (eval echo configure:3009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    :
  else
--- 3060,3066 ----
  exit (0); }
  
  EOF
! if { (eval echo configure:3064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    :
  else
***************
*** 3029,3040 ****
  fi
  
  echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6
! echo "configure:3033: checking for u_int8_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int8_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3038 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 3084,3095 ----
  fi
  
  echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6
! echo "configure:3088: checking for u_int8_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int8_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3093 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 3062,3073 ****
  fi
  
          echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
! echo "configure:3066: checking for u_int16_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3071 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 3117,3128 ----
  fi
  
          echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
! echo "configure:3121: checking for u_int16_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3126 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 3095,3106 ****
  fi
  
          echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
! echo "configure:3099: checking for u_int32_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3104 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 3150,3161 ----
  fi
  
          echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
! echo "configure:3154: checking for u_int32_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3159 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 3130,3141 ****
  else
  	if test "$broken_types" = "yes" ; then
  		echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6
! echo "configure:3134: checking for u_int8_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int8_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3139 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 3185,3196 ----
  else
  	if test "$broken_types" = "yes" ; then
  		echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6
! echo "configure:3189: checking for u_int8_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int8_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3194 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 3163,3174 ****
  fi
  
  		echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
! echo "configure:3167: checking for u_int16_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3172 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 3218,3229 ----
  fi
  
  		echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
! echo "configure:3222: checking for u_int16_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3227 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 3196,3207 ****
  fi
  
  		echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
! echo "configure:3200: checking for u_int32_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3205 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 3251,3262 ----
  fi
  
  		echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
! echo "configure:3255: checking for u_int32_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3260 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 3230,3241 ****
  
  	else
  		echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6
! echo "configure:3234: checking for u_int8_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int8_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3239 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 3285,3296 ----
  
  	else
  		echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6
! echo "configure:3289: checking for u_int8_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int8_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3294 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 3263,3274 ****
  fi
  
  		echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
! echo "configure:3267: checking for u_int16_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3272 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 3318,3329 ----
  fi
  
  		echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
! echo "configure:3322: checking for u_int16_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3327 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 3296,3307 ****
  fi
  
  		echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
! echo "configure:3300: checking for u_int32_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3305 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 3351,3362 ----
  fi
  
  		echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
! echo "configure:3355: checking for u_int32_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3360 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
***************
*** 3343,3349 ****
  # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  # ./install, which can be erroneously created by make from ./install.sh.
  echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
! echo "configure:3347: checking for a BSD compatible install" >&5
  if test -z "$INSTALL"; then
  if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 3398,3404 ----
  # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  # ./install, which can be erroneously created by make from ./install.sh.
  echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
! echo "configure:3402: checking for a BSD compatible install" >&5
  if test -z "$INSTALL"; then
  if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
diff -cr snort-1.7.orig/configure.in snort-1.7.buffered.option/configure.in
*** snort-1.7.orig/configure.in	Fri Jan  5 19:21:33 2001
--- snort-1.7.buffered.option/configure.in	Mon May 21 23:04:24 2001
***************
*** 174,179 ****
--- 174,180 ----
  
  AC_CHECK_FUNCS(snprintf)
  AC_CHECK_FUNCS(strerror)
+ AC_CHECK_FUNCS(setlinebuf)
  
  AC_TRY_COMPILE([
  #include <stdio.h>
diff -cr snort-1.7.orig/snort.8 snort-1.7.buffered.option/snort.8
*** snort-1.7.orig/snort.8	Tue Jan  2 19:52:10 2001
--- snort-1.7.buffered.option/snort.8	Tue May 22 00:19:38 2001
***************
*** 162,167 ****
--- 162,170 ----
  to your favorite security mailing list!
  .IP -p
  Turn off promiscuous mode sniffing.
+ .IP -B
+ Flush stdout on line write. This allows you to watch output while it is redirected/piped.
+ For example snort -Bv > foo && tail -f foo.
  .IP "-q"
   Quiet operation. Don't display banner and initialization information.
  .IP "-r tcpdump-file"
diff -cr snort-1.7.orig/snort.c snort-1.7.buffered.option/snort.c
*** snort-1.7.orig/snort.c	Fri Jan  5 08:37:08 2001
--- snort-1.7.buffered.option/snort.c	Mon May 21 23:18:01 2001
***************
*** 489,494 ****
--- 489,495 ----
            "\n                  \"unsock\" enables UNIX socket logging (experimental).\n", stderr);
      fputs("        -a         Display ARP packets\n", stderr);
      fputs("        -b         Log packets in tcpdump format (much faster!)\n", stderr);
+     fputs("        -B         Flush stdout each line write\n", stderr);
      fputs("        -c <rules> Use Rules File <rules>\n", stderr);
      fputs("        -C         Print out payloads with character data only (no hex)\n", stderr);
      fputs("        -d         Dump the Application Layer\n", stderr);
***************
*** 567,573 ****
  
      /* loop through each command line var and process it */
      while((ch = getopt(argc, argv,
!                        "XL:IOCqS:pNA:F:DM:br:xeh:l:dc:n:P:i:vV?aso6u:g:t:")) != -1)
      {
  #ifdef DEBUG
          printf("Processing cmd line switch: %c\n", ch);
--- 568,574 ----
  
      /* loop through each command line var and process it */
      while((ch = getopt(argc, argv,
!                        "XL:IOCqS:pNA:F:DM:br:xeh:l:dc:n:P:i:vV?aBso6u:g:t:")) != -1)
      {
  #ifdef DEBUG
          printf("Processing cmd line switch: %c\n", ch);
***************
*** 615,620 ****
--- 616,634 ----
  #endif
                  pv.logbin_flag = 1;
                  pv.log_cmd_override = 1;
+ 
+                 break;
+ 
+             case 'B':                /* flush stdout on line
+                                      * write */
+ #ifdef DEBUG
+                 printf("flush stdout on line write\n");
+ #endif
+ #ifdef HAVE_SETLINEBUF
+                 setlinebuf(stdout);
+ #else
+                 setvbuf(stdout, NULL, _IOLBF, 0);
+ #endif
  
                  break;
  


More information about the Snort-devel mailing list