2 changed files with 23 additions and 1 deletions
@ -0,0 +1,20 @@
|
||||
libpcap opens /dev/bpfX as O_RDONLY rather than O_RDWR. This
|
||||
affects applications which open BPF using pcap_open_live(),
|
||||
then get the fileno and try to use it to send packets. An
|
||||
example application having this problem with BGP is UCARP
|
||||
(http://www.ucarp.org/), which silently fails to send packets.
|
||||
See also: http://www.freebsd.org/cgi/query-pr.cgi?pr=72814
|
||||
|
||||
Index: pcap-bpf.c
|
||||
--- pcap-bpf.c.orig 2003-11-22 01:06:28 +0100
|
||||
+++ pcap-bpf.c 2004-12-09 22:57:15 +0100
|
||||
@@ -468,6 +468,8 @@
|
||||
do {
|
||||
(void)snprintf(device, sizeof(device), "/dev/bpf%d", n++);
|
||||
- fd = open(device, O_RDONLY);
|
||||
+ fd = open(device, O_RDWR);
|
||||
+ if (fd < 0 && errno == EACCES)
|
||||
+ fd = open(device, O_RDONLY);
|
||||
} while (fd < 0 && errno == EBUSY);
|
||||
|
||||
/*
|
||||
Loading…
Reference in new issue