Open the BPF file descriptor as read-write. Some pcap-using programs

(notably, simulators) expect to be able to send packets on the descriptor,
as well as receive.
This commit is contained in:
thorpej 2002-10-19 22:03:44 +00:00
parent 32b88027c7
commit 6ac6a2a09f

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcap-bpf.c,v 1.8 2002/09/22 16:13:01 thorpej Exp $ */ /* $NetBSD: pcap-bpf.c,v 1.9 2002/10/19 22:03:44 thorpej Exp $ */
/* /*
* Copyright (c) 1993, 1994, 1995, 1996 * Copyright (c) 1993, 1994, 1995, 1996
@ -26,7 +26,7 @@
static const char rcsid[] = static const char rcsid[] =
"@(#) Header: pcap-bpf.c,v 1.29 96/12/31 20:53:40 leres Exp (LBL)"; "@(#) Header: pcap-bpf.c,v 1.29 96/12/31 20:53:40 leres Exp (LBL)";
#else #else
__RCSID("$NetBSD: pcap-bpf.c,v 1.8 2002/09/22 16:13:01 thorpej Exp $"); __RCSID("$NetBSD: pcap-bpf.c,v 1.9 2002/10/19 22:03:44 thorpej Exp $");
#endif #endif
#endif #endif
@ -152,7 +152,7 @@ bpf_open(pcap_t *p, char *errbuf)
*/ */
do { do {
(void)snprintf(device, sizeof device, "/dev/bpf%d", n++); (void)snprintf(device, sizeof device, "/dev/bpf%d", n++);
fd = open(device, O_RDONLY); fd = open(device, O_RDWR);
} while (fd < 0 && errno == EBUSY); } while (fd < 0 && errno == EBUSY);
/* /*