diff options
author | drochner <drochner> | 2006-02-24 22:53:41 +0000 |
---|---|---|
committer | drochner <drochner> | 2006-02-24 22:53:41 +0000 |
commit | 2ba8d199016e0aee7178a732dfc8ffc092bd780a (patch) | |
tree | 349947347fe018d36ca3b68ee77e5dba2c2025ef /net/libpcap/patches | |
parent | 5b11f6e7c3d55297452c793abd6ed50b48b0886c (diff) | |
download | pkgsrc-2ba8d199016e0aee7178a732dfc8ffc092bd780a.tar.gz |
import from the NetBSD tree: use the cloning /dev/bpf on NetBSD
if _PATH_BPF is defined
bump PKGREVISION
Diffstat (limited to 'net/libpcap/patches')
-rw-r--r-- | net/libpcap/patches/patch-ad | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/net/libpcap/patches/patch-ad b/net/libpcap/patches/patch-ad new file mode 100644 index 00000000000..b3a49f503c2 --- /dev/null +++ b/net/libpcap/patches/patch-ad @@ -0,0 +1,48 @@ +$NetBSD: patch-ad,v 1.1 2006/02/24 22:53:41 drochner Exp $ + +--- pcap-bpf.c.orig 2006-02-24 23:23:45.000000000 +0100 ++++ pcap-bpf.c +@@ -34,6 +34,9 @@ static const char rcsid[] _U_ = + #include <sys/file.h> + #include <sys/ioctl.h> + #include <sys/utsname.h> ++#ifdef __NetBSD__ ++#include <paths.h> ++#endif + + #include <net/if.h> + +@@ -523,8 +526,12 @@ static inline int + bpf_open(pcap_t *p, char *errbuf) + { + int fd; ++#ifndef _PATH_BPF + int n = 0; + char device[sizeof "/dev/bpf0000000000"]; ++#else ++ const char *device = _PATH_BPF; ++#endif + + #ifdef _AIX + /* +@@ -536,6 +543,7 @@ bpf_open(pcap_t *p, char *errbuf) + return (-1); + #endif + ++#ifndef _PATH_BPF + /* + * Go through all the minors and find one that isn't in use. + */ +@@ -566,6 +574,12 @@ bpf_open(pcap_t *p, char *errbuf) + if (fd < 0) + snprintf(errbuf, PCAP_ERRBUF_SIZE, "(no devices found) %s: %s", + device, pcap_strerror(errno)); ++#else ++ if ((fd = open(device, O_RDWR)) == -1 && ++ (errno != EACCES || (fd = open(device, O_RDONLY)) == -1)) ++ snprintf(errbuf, PCAP_ERRBUF_SIZE, ++ "(cannot open device) %s: %s", device, pcap_strerror(errno)); ++#endif + + return (fd); + } |