UDP/TCP send/recv buffers on Solaris 2.5.1

From: Chris Tilbury <cudch@dont-contact.us>
Date: Tue, 8 Jul 1997 17:56:40 +0100

In the midst of checking out our proxy caching system, which is
having a few performance problems at the moment, I've noticed
something odd going on.

Squid's "configure" has set SQUID_UDP_SO_SNDBUF, SQUID_UDP_SO_RCVBUF,
SQUID_TCP_SO_SNDBUF and SQUID_TCP_SO_RCVBUF all to 16384 - the "default"
value and that chosen when "configure" thinks you're cross compiling.

What's odd here is that we're not cross compiling and these values
are completely incorrect. On the machine in question, the UDP buffers
are both at 8192 and the TCP buffers are at 49152 - quite
different. Whilst I'd expect the TCP buffer size to be reduced to
16384 by the C preprocessor, it doesn't appear to be mangling the UDP
buffer size, which means that somehow "configure" is getting this wrong.

Looking at the config.log, the programs which configure builds and
runs to determine these are all failing.

-- excerpt begins --

configure:3067: checking Default UDP send buffer size
configure:3091: gcc -o conftest -g -O2 -Wall -g conftest.c -lm -lresolv -lsocket -lnsl 1>&5
configure:3080: warning: return-type defaults to `int'
configure: In function `main':
configure:3083: warning: passing arg 4 of `getsockopt' from incompatible pointer type
configure: failed program was:
#line 3072 "configure"
#include "confdefs.h"
 
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
main ()
{
        int fd,val=0,len=sizeof(int);
        if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
        if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
        if (val<=0) exit(1);
        fprintf (fopen("conftestval", "w"), "%d\n", val);
        exit(0);
}

-- excerpt ends --

(the other three are showing basically the same warnings).

This strikes me as not terribly good. conftestval doesn't get written
by this code.

Looking around Sunsolve online reveals that there are two bugIDs
(fixed, but not integrated) relating to an inability to read the
default buffer sizes using getsockopt under Solaris 2.x (works under
Solaris 1.x). So, what looks to be happening is that getsockopt is
returning "0" (according to the Sun documentation this is what you'll
get back) and the program exits causing the 16384 value to be used.

Has anyone else run into this - it strikes me as being potentially
quite important. For as long as we've been running squid at least,
it's had incorrect defaults compiled in, which doesn't seem very good
(or does it not matter at all?) I'm just entering the correct values
obtained using ndd -get /dev/tcp [ tcp_xmit_hiwat | tcp_recv_hiwat ]
and ndd -get /dev/udp [ udp_xmit_hiwat | udp_recv_hiwat ] to see what
difference if any this makes.

The bugIDs for those interested are network/socket/1143932 and
network/socket/1213189.

Cheers,

Chris

-- 
 Chris Tilbury, UNIX Systems Admin, Computing Services, University of Warwick
 EMAIL: cudch@csv.warwick.ac.uk  PHONE: +44 1203 523365(V)/+44 1203 523267(F)
Received on Tue Jul 08 1997 - 10:05:21 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:35:42 MST