summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2016-09-21 06:02:04 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2016-09-21 06:02:04 +0000
commit281b66eb31a8d2b3669cb87f78cd807183d9c42e (patch)
tree4bfefada951eef06af1f70cc1956bdf26be7889a /regress/lib
parentf42f408607507b9488595613fd5f507e5173de9f (diff)
set BIOCIMMEDIATE, makes the test work for lo0, which does more buffering
than regular interfaces
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libpthread/pcap/pcap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/regress/lib/libpthread/pcap/pcap.c b/regress/lib/libpthread/pcap/pcap.c
index faa8d38384c..1fed64d9f87 100644
--- a/regress/lib/libpthread/pcap/pcap.c
+++ b/regress/lib/libpthread/pcap/pcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcap.c,v 1.5 2003/07/31 21:48:05 deraadt Exp $ */
+/* $OpenBSD: pcap.c,v 1.6 2016/09/21 06:02:03 otto Exp $ */
/*
* Placed in the PUBLIC DOMAIN
*/
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <sys/ioctl.h>
#include "test.h"
@@ -30,12 +31,14 @@ pcap_thread(void *arg)
{
char errbuf[PCAP_ERRBUF_SIZE];
pcap_t *handle;
+ int on = 1;
SET_NAME("pcap_thread");
CHECKr(pthread_mutex_lock(&dummy));
handle = pcap_open_live(LOOPBACK_IF, SNAPLEN, NO_PROMISC, 0, errbuf);
if (!handle)
PANIC("You may need to run this test as UID 0 (root)");
+ ASSERT(ioctl(pcap_fileno(handle), BIOCIMMEDIATE, &on) != -1);
CHECKr(pthread_mutex_unlock(&dummy));
CHECKr(pthread_cond_signal(&syncer));
ASSERT(pcap_loop(handle, PKTCNT, packet_ignore, 0) != -1);