[flow-tools] Patch for 0.57: use #define for socket buffer size constant

Mark Fullmer maf@eng.oar.net
Thu, 25 Apr 2002 01:51:08 -0400


Will be in 0.58.  Are there actually systems that will accept those
larger buffer sizes without kernel tweaks?  If so it would probably
be worth auto scaling up FT_SO_BUFSIZE when compression is enabled.

> Only in flow-tools-0.57-dist/lib: ftpaths.h

What's this about?

mark

On Mon, Apr 22, 2002 at 05:47:35PM -0700, Jos Backus wrote:
> This patch makes it easier (for me, at least) to crank up the UDP socket
> buffer size. Please consider including this in the next version.
> 
> Thanks!
> 
> diff -ru flow-tools-0.57-dist/lib/ftlib.h flow-tools-0.57/lib/ftlib.h
> --- flow-tools-0.57-dist/lib/ftlib.h	Sat Apr 20 15:29:11 2002
> +++ flow-tools-0.57/lib/ftlib.h	Mon Apr 22 17:36:57 2002
> @@ -178,6 +178,7 @@
>  #define FT_Z_BUFSIZE           16384 /* inflate/deflate buffer size */
>  #define FT_D_BUFSIZE           32768 /* stream data buffer size */
>  #define FT_RCV_BUFSIZE         2048  /* enough to handle largest export */
> +#define FT_SO_BUFSIZE          (224*1024) /* UDP socket buffer size */
>  
>  #define FT_IO_SVERSION         3     /* stream version */
>  
> Only in flow-tools-0.57-dist/lib: ftpaths.h
> diff -ru flow-tools-0.57-dist/src/flow-capture.c flow-tools-0.57/src/flow-capture.c
> --- flow-tools-0.57-dist/src/flow-capture.c	Sat Apr 20 15:28:35 2002
> +++ flow-tools-0.57/src/flow-capture.c	Mon Apr 22 17:39:32 2002
> @@ -411,7 +411,7 @@
>    if ((ftnet.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
>      fterr_err(1, "socket()");
>  
> -  if (bigsockbuf(ftnet.fd, SO_RCVBUF, 224*1024) < 0)
> +  if (bigsockbuf(ftnet.fd, SO_RCVBUF, FT_SO_BUFSIZE) < 0)
>      fterr_err(1, "bigsockbuf()");
>  
>  /* multicast capable? */
> @@ -606,7 +606,7 @@
>  
>  #endif /* HAVE_LIBWRAP */
>        
> -      if (bigsockbuf(client_rec->fd, SO_SNDBUF, 224*1024) < 0)
> +      if (bigsockbuf(client_rec->fd, SO_SNDBUF, FT_SO_BUFSIZE) < 0)
>          fterr_warn("bigsockbuf()");
>  
>        /* log it */
> diff -ru flow-tools-0.57-dist/src/flow-fanout.c flow-tools-0.57/src/flow-fanout.c
> --- flow-tools-0.57-dist/src/flow-fanout.c	Sat Apr 20 15:28:35 2002
> +++ flow-tools-0.57/src/flow-fanout.c	Mon Apr 22 17:39:43 2002
> @@ -268,7 +268,7 @@
>      if ((peers[n].fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
>        fterr_err(1, "socket()");
>  
> -    if (bigsockbuf(peers[n].fd, (n ? SO_SNDBUF : SO_RCVBUF), 224*1024) < 0)
> +    if (bigsockbuf(peers[n].fd, (n ? SO_SNDBUF : SO_RCVBUF), FT_SO_BUFSIZE) < 0)
>        fterr_err(1, "bigsockbuf()");
>  
>  #ifdef IP_ADD_MEMBERSHIP
> @@ -314,7 +314,7 @@
>    if ((ftnet.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
>      fterr_err(1, "socket()");
>  
> -  if (bigsockbuf(ftnet.fd, SO_RCVBUF, 224*1024) < 0)
> +  if (bigsockbuf(ftnet.fd, SO_RCVBUF, FT_SO_BUFSIZE) < 0)
>      fterr_err(1, "bigsockbuf()");
>  
>  
> diff -ru flow-tools-0.57-dist/src/flow-receive.c flow-tools-0.57/src/flow-receive.c
> --- flow-tools-0.57-dist/src/flow-receive.c	Sun Feb 10 14:30:01 2002
> +++ flow-tools-0.57/src/flow-receive.c	Mon Apr 22 17:39:49 2002
> @@ -250,7 +250,7 @@
>    if ((ftnet.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
>      fterr_err(1, "socket()");
>  
> -  if (bigsockbuf(ftnet.fd, SO_RCVBUF, 224*1024) < 0)
> +  if (bigsockbuf(ftnet.fd, SO_RCVBUF, FT_SO_BUFSIZE) < 0)
>      fterr_err(1, "bigsockbuf()");
>  
>  /* multicast capable? */
> diff -ru flow-tools-0.57-dist/src/flow-send.c flow-tools-0.57/src/flow-send.c
> --- flow-tools-0.57-dist/src/flow-send.c	Fri Apr 19 14:09:18 2002
> +++ flow-tools-0.57/src/flow-send.c	Mon Apr 22 17:39:56 2002
> @@ -150,7 +150,7 @@
>    if ((udp_sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
>      fterr_err(1, "socket()");
>  
> -  if (bigsockbuf(udp_sock, SO_SNDBUF, 224*1024) < 0)
> +  if (bigsockbuf(udp_sock, SO_SNDBUF, FT_SO_BUFSIZE) < 0)
>      fterr_err(1, "bigsockbuf()");
>  
>  #ifdef IP_ADD_MEMBERSHIP
> 
> -- 
> Jos Backus                 _/  _/_/_/        Santa Clara, CA
>                           _/  _/   _/
>                          _/  _/_/_/             
>                     _/  _/  _/    _/
> jos@catnook.com     _/_/   _/_/_/            use Std::Disclaimer;
> 
> _______________________________________________
> flow-tools@splintered.net
> http://www.splintered.net/sw/flow-tools