tcpdump mailing list archives

Re: setting rcvbuf


From: John Heffner <jheffner () psc edu>
Date: Wed, 16 Jun 2004 12:56:51 -0400 (EDT)

On Tue, 15 Jun 2004, Guy Harris wrote:


On Jun 15, 2004, at 2:49 PM, John Heffner wrote:

I've found that on my linux machines, setting the rcvbuf on the packet
socket bigger helps to reduce drops at high rates.

I implemented the following, though I'm not sure how this works on BSD
and
other UNIXes.

It *doesn't* work on BSD, unfortunately - you can't set the buffer size
after binding a network interface to a BPF device, and, as that's done
at open time, you can't set the buffer size on an open pcap_t.

The ultimate fix is probably to have a new open routine that takes the
buffer size as an argument (but don't implement that - there's a bunch
of other stuff for which we need a new open API, and we don't want to
introduce one new API and then keep introducing new ones; I'm thinking
of an API that takes an attribute/value list of open parameters, so we
can add new parameters as needed without having to introduce a whole
new API).

A short-term fix would be to implement "pcap_setbuff()" routines for
all platforms - but have, on platforms where you can't set it, either
no-op routines or routines that return an error - and, when we have the
new open routine, deprecate "pcap_setbuff()" in favor of the new open
routine.


How about making an error non-fatal?

Thanks,
  -John


                if(UserBufferSize != 1000000)
                        if(pcap_setbuff(pd, UserBufferSize)==-1){
-                               error("%s", pcap_geterr(pd));
+                               warning("%s", pcap_geterr(pd));
                        }



+#ifndef WIN32
+       if (setsockopt(p->fd, SOL_SOCKET, SO_RCVBUF, &dim, sizeof (dim)) != 0) {
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Unable to set buffer size.\n");
+               return -1;
+       }
+
+       return 0;
+#else

-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.


Current thread: