Subject: Re: How to increase the socket buffer in netbsd 1.3.2
To: diepchitran <>
From: Kevin Lahey <>
List: tech-net
Date: 04/17/2001 17:02:42
[I sent this just to tech-net, which is probably where it belongs.]

In message <>,
diepchitran writes:
>I use ttcp to run a test on a  long delay and high speed testbed (the
>bandwidth-delay-product is 3.125MByte). 

Hmmm.  I'm still figuring out whether to be jealous or sympathetic.
Sounds like an interesting network.

>When I set the -b (socket buffer
>size ) option greater than 1.6MByte, I get an error message "no buffer
>space available" ( errorno:55). I increased the SB_MAX to 6.25MByte (2*BDP)
>,  the tcp_sendspace and tcp_recvspace to 65K and 6.25MBbyte, and the
>NMBCLUSTERS to 8194, but I still get the same error message. Is there any
>limitation on socket buffer size in version 1.3.2 ?. If not, could you
>please show me what I should do to increase the socket buffer size?. 

Wow, you must be living right.  I couldn't even get NetBSD-(sorta)-current
to *boot* with an SB_MAX of only 4MB!  It craps out trying to create a

If you check out sbreserve() in /sys/kern/uipc_socket2.c, you'll see
that it does some funky math to try to ensure that sb_max isn't
too big:  

        if (cc == 0 || cc > sb_max * MCLBYTES / (MSIZE + MCLBYTES))
                return (0);

It looks to me like this could badly overflow if your
unsigned long is only 32-bits long and sb_max * MCLBYTES is greater
than 4GB.  For a quick fix, why not try commenting out that code,
or throwing in an appropriate cast?  I found that made it work for me...

Good luck,