sk->sndbuf and sk->rcvbuf problems

Dave Turner (turner@cyclops.ameslab.gov)
Tue, 17 Feb 1998 22:06:49 -0600


In file /usr/src/linux/net/core/sock.c of 2.1.85, the value input
with the SO_SNDBUF parameter from setsockopt() gets doubled before
it is assigned to sk->sndbuf. The same is true for the SO_RCVBUF case.

case SO_SNDBUF:
/*
* The spec isnt clear if ENOBUFS or EINVAL
* is best
*/

printk(KERN_DEBUG "setting SO_SNDBUF %d\n", val);
if (val > sysctl_wmem_max)
return -EINVAL;

/* FIXME: the tcp code should be made to work even
* with small sndbuf values.
*/
sk->sndbuf = max(val*2,2048);

Also, it would be nice to be able to adjust the maximum buffer size
separate from the default buffer size. They are now both initially
set to 65535 bytes. I would suggest creating SK_WMEM_DEFAULT and
SK_RMEM_DEFAULT macros in /usr/include/linux/skbuff.h and setting them
to 65535 bytes, then set the SK_WMEM_MAX and SK_RMEM_MAX macros
to something large ( > 4 MB is my preference), then alter the sock.c
file to use these initial values. This would keep the same default
buffer size while allowing a user to increase the buffer size with
setsockopt().

Dave Turner

*******************************************************************
* Dr Dave Turner Asst Scientist - Ames Lab - ISU *
* 524 Physics turner@ameslab.gov *
* Iowa State University Phone:(515)-294-8872 *
* Ames, IA 50011 Fax: (515)-294-0689 *
*******************************************************************