[dns-operations] [PATCH] dnscap on OS X
Mark Santcroos
mark at NLnetLabs.nl
Fri May 18 08:34:27 UTC 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Attached patch makes dnscap work on OS X.
That is without -g functionality, haven't looked into the libbind
linking yet.
Mark
- --
Mark Santcroos
NLnet Labs
http://www.nlnetlabs.nl/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGTWUAvgq6Qtvn644RAvwZAJ9wErbAa2Eo/JdlHVeMtqTQNGmzPgCdEsZK
cULSxJiBlROMEr1oJrxwv1k=
=ToeA
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: dnscap.c
===================================================================
RCS file: /proj/cvsroot/dnscap/dnscap.c,v
retrieving revision 1.12
diff -d -u -r1.12 dnscap.c
--- dnscap.c 16 May 2007 23:10:18 -0000 1.12
+++ dnscap.c 18 May 2007 08:26:14 -0000
@@ -32,6 +32,11 @@
#include <sys/select.h>
#include <sys/socket.h>
+#ifdef __APPLE__
+#include <net/ethernet.h>
+#include <arpa/nameser_compat.h>
+#endif
+
#ifdef __linux__
# define __FAVOR_BSD
# define __USE_GNU
@@ -790,10 +795,18 @@
mypcap_ptr mypcap;
fd_set readfds;
int n;
+ struct timeval * tvp = NULL;
+#ifdef __APPLE__
+ struct timeval tv;
+
+ tvp = &tv;
+ bzero(&tv, sizeof(struct timeval));
+ tv.tv_usec = TO_MS;
+#endif
do {
- readfds = mypcap_fdset;
- n = select(pcap_maxfd+1, &readfds, NULL, NULL, NULL);
+ FD_COPY(&mypcap_fdset, &readfds);
+ n = select(pcap_maxfd+1, &readfds, NULL, NULL, tvp);
} while (n < 0 && errno == EINTR && !main_exit);
if (n < 0) {
if (errno != EINTR)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dnscap_osx.diff.sig
Type: application/octet-stream
Size: 65 bytes
Desc: not available
URL: <https://lists.dns-oarc.net/pipermail/dns-operations/attachments/20070518/80caee90/attachment.obj>
More information about the dns-operations
mailing list