aboutsummaryrefslogtreecommitdiff
path: root/pcap-dlpi.c
diff options
context:
space:
mode:
authorguy <guy>2003-02-04 05:42:03 +0000
committerguy <guy>2003-02-04 05:42:03 +0000
commit2256aabb91abe272b40cb528ec1eb7c7b68dc131 (patch)
tree3a5806a2b27b8881821123e248f9ab37e6f308dc /pcap-dlpi.c
parent04672f261bdd12bcc9676a0b7b1d996da9af8791 (diff)
As per suggestions from the anonymous SourceForge user who submitted bug
673958, make two changes on Solaris: don't set SB_NO_DROPS - doing so means that bufmod doesn't drop packets, so it can't report the number of drops, but packets probably still get dropped *somewhere*, if for no other reason than that the system refuses to allocate more mblks/dblks, even if it doesn't discard messages that arrive at the stream head if it's full; set the chunk size to 65536, as otherwise packets are dropped too easily. snoop also appears not to set SB_NO_DROPS and also appears to set the chunk size to 65536, so that's probably the right thing to do.
Diffstat (limited to 'pcap-dlpi.c')
-rw-r--r--pcap-dlpi.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/pcap-dlpi.c b/pcap-dlpi.c
index d31da9e5..6b8c6c9d 100644
--- a/pcap-dlpi.c
+++ b/pcap-dlpi.c
@@ -38,7 +38,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.82 2003-01-03 08:33:54 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.83 2003-02-04 05:42:03 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -275,7 +275,12 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
#endif
register dl_info_ack_t *infop;
#ifdef HAVE_SYS_BUFMOD_H
- bpf_u_int32 ss, flag;
+ /*
+ * XXX - is uint_t always 32 bits? If not, these should be
+ * uint_t, at least on systems that have that type.
+ */
+ bpf_u_int32 ss;
+ bpf_u_int32 chunksize;
#ifdef HAVE_SOLARIS
register char *release;
bpf_u_int32 osmajor, osminor, osmicro;
@@ -593,20 +598,6 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
}
/*
- ** Set up the bufmod flags
- */
- if (strioctl(p->fd, SBIOCGFLAGS, sizeof(flag), (char *)&flag) < 0) {
- snprintf(ebuf, PCAP_ERRBUF_SIZE, "SBIOCGFLAGS: %s",
- pcap_strerror(errno));
- goto bad;
- }
- flag |= SB_NO_DROPS;
- if (strioctl(p->fd, SBIOCSFLAGS, sizeof(flag), (char *)&flag) != 0) {
- snprintf(ebuf, PCAP_ERRBUF_SIZE, "SBIOCSFLAGS: %s",
- pcap_strerror(errno));
- goto bad;
- }
- /*
** Set up the bufmod timeout
*/
if (to_ms != 0) {
@@ -623,6 +614,22 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms,
#endif
/*
+ ** Set the chunk length to 65536; that appears to be the biggest
+ ** value to which you can set it, and doing so reduces the
+ ** number of packet drops.
+ **
+ ** XXX - what is the chunk size if it's not set? 0, meaning
+ ** no buffering?
+ */
+ chunksize = 65536;
+ if (strioctl(p->fd, SBIOCSCHUNK, sizeof(chunksize), (char *)&chunksize)
+ != 0) {
+ snprintf(ebuf, PCAP_ERRBUF_SIZE, "SBIOCSCHUNKP: %s",
+ pcap_strerror(errno));
+ goto bad;
+ }
+
+ /*
** As the last operation flush the read side.
*/
if (ioctl(p->fd, I_FLUSH, FLUSHR) != 0) {