aboutsummaryrefslogtreecommitdiff
path: root/pcap.c
diff options
context:
space:
mode:
authorguy <guy>2003-11-20 01:21:25 +0000
committerguy <guy>2003-11-20 01:21:25 +0000
commit028bb1b31de62247b5c23a2ce76501c985ea1f14 (patch)
treea4bfb151952749fd1621bd6181ad560234b6c6ea /pcap.c
parentd7bc98d08b428b7d6a100bc02025e3f9074bc804 (diff)
From Koryn Grant <koryn@endace.com> - DAG support enhancements and fixes:
Added support for nonblocking operation. Added support for processing more than a single packet in pcap_dispatch(). Fixed bug in loss counter code. Improved portability of loss counter code (e.g. use UINT_MAX instead of 0xffff). Removed unused local variables. Added required headers (ctype.h, limits.h, unistd.h, netinet/in.h). Changed semantics to match those of standard pcap on linux. - packets rejected by the filter are not counted.
Diffstat (limited to 'pcap.c')
-rw-r--r--pcap.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/pcap.c b/pcap.c
index 2c81a768..f9cb99bd 100644
--- a/pcap.c
+++ b/pcap.c
@@ -33,7 +33,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.66 2003-11-18 22:14:24 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.67 2003-11-20 01:21:26 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -61,6 +61,11 @@ static const char rcsid[] _U_ =
#include "pcap-int.h"
+#ifdef HAVE_DAG_API
+#include <dagnew.h>
+#include <dagapi.h>
+#endif
+
int
pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
{
@@ -558,6 +563,15 @@ pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf)
*/
return (0);
}
+
+#if HAVE_DAG_API
+ if (nonblock) {
+ p->md.dag_offset_flags |= DAGF_NONBLOCK;
+ } else {
+ p->md.dag_offset_flags &= ~DAGF_NONBLOCK;
+ }
+#endif /* HAVE_DAG_API */
+
#ifndef WIN32
fdflags = fcntl(p->fd, F_GETFL, 0);
if (fdflags == -1) {