]> The Tcpdump Group git mirrors - libpcap/commitdiff
From Darren Reed: some changes to support BPF on Solaris. Update his
authorGuy Harris <[email protected]>
Sat, 18 Apr 2009 20:04:27 +0000 (13:04 -0700)
committerGuy Harris <[email protected]>
Sat, 18 Apr 2009 20:04:27 +0000 (13:04 -0700)
e-mail address while we're at it.

Use <fcntl.h> rather than <sys/file.h> in pcap-bpf.c - that's the right
header for open().

Don't include <sys/timeb.h> - it doesn't define anything that pcap-bpf.c
should need.

CREDITS
configure
configure.in
pcap-bpf.c

diff --git a/CREDITS b/CREDITS
index 9b7577d33b3ee9a38f3ccc39b2a3358c8fb30a9e..7622f7ce974ccd513970cbe06edac235a85c52a9 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -26,7 +26,7 @@ Additional people who have contributed patches:
        Chris Pepper                    <pepper at mail dot reppep dot com>
        Christian Peron                 <csjp at freebsd dot org>
        Daniele Orlandi                 <daniele at orlandi dot com>
-       Darren Reed                     <darrenr at reed dot wattle dot id dot au>
+       Darren Reed                     <darrenr at sun dot com>
        David Kaelbling                 <drk at sgi dot com>
        David Young                     <dyoung at ojctech dot com>
        Dean Gaudet                     <dean at arctic dot org>
index 691d08c5459a3d9135698c6e37c4018f24b09ebd..db9c1cff16fd679d8caf61c439ed28eba5844306 100755 (executable)
--- a/configure
+++ b/configure
@@ -6302,10 +6302,10 @@ elif test -r /usr/include/odmi.h ; then
        # We check for odmi.h instead.
        #
        V_PCAP=bpf
-elif test -r /usr/include/sys/dlpi.h ; then
-       V_PCAP=dlpi
 elif test -c /dev/bpf0 ; then          # check again in case not readable
        V_PCAP=bpf
+elif test -r /usr/include/sys/dlpi.h ; then
+       V_PCAP=dlpi
 elif test -c /dev/enet ; then          # check again in case not readable
        V_PCAP=enet
 elif test -c /dev/nit ; then           # check again in case not readable
index 6569bf161b83186a1c281c1fa455f6a9c197b144..6aaeeae101bdb64cc93825d39c189de8ccc1c49f 100644 (file)
@@ -28,10 +28,13 @@ AC_SYS_LARGEFILE
 AC_FUNC_FSEEKO
 
 dnl
-dnl libpcap doesn't itself use <sys/ioccom.h>; however, the test program
-dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to
-dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
-dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
+dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
+dnl include <sys/ioccom.h>, and we were to drop support for older
+dnl releases without that fix, so that pcap-bpf.c doesn't need to
+dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
+dnl in "aclocal.m4" uses it, so we would still have to test for it
+dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
+dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
 dnl
 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h)
 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
@@ -256,10 +259,10 @@ elif test -r /usr/include/odmi.h ; then
        # We check for odmi.h instead.
        #
        V_PCAP=bpf
-elif test -r /usr/include/sys/dlpi.h ; then
-       V_PCAP=dlpi
 elif test -c /dev/bpf0 ; then          # check again in case not readable
        V_PCAP=bpf
+elif test -r /usr/include/sys/dlpi.h ; then
+       V_PCAP=dlpi
 elif test -c /dev/enet ; then          # check again in case not readable
        V_PCAP=enet
 elif test -c /dev/nit ; then           # check again in case not readable
index e4467ce76152f321c5c6a472398367d5ba0bf13a..36adb0de123568923a17a507fdc6faee828c56b1 100644 (file)
@@ -32,10 +32,24 @@ static const char rcsid[] _U_ =
 #include <sys/mman.h>
 #endif
 #include <sys/time.h>
-#include <sys/timeb.h>
 #include <sys/socket.h>
-#include <sys/file.h>
+/*
+ * <net/bpf.h> defines ioctls, but doesn't include <sys/ioccom.h>.
+ *
+ * We include <sys/ioctl.h> as it might be necessary to declare ioctl();
+ * at least on *BSD and Mac OS X, it also defines various SIOC ioctls -
+ * we could include <sys/sockio.h>, but if we're already including
+ * <sys/ioctl.h>, which includes <sys/sockio.h> on those platforms,
+ * there's not much point in doing so.
+ *
+ * If we have <sys/ioccom.h>, we include it as well, to handle systems
+ * such as Solaris which don't arrange to include <sys/ioccom.h> if you
+ * include <sys/ioctl.h>
+ */
 #include <sys/ioctl.h>
+#ifdef HAVE_SYS_IOCCOM_H
+#include <sys/ioccom.h>
+#endif
 #include <sys/utsname.h>
 
 #ifdef HAVE_ZEROCOPY_BPF
@@ -92,6 +106,7 @@ static int odmlockid = 0;
 #endif /* _AIX */
 
 #include <ctype.h>
+#include <fcntl.h>
 #include <errno.h>
 #include <netdb.h>
 #include <stdio.h>
@@ -801,7 +816,7 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
 
                        case EWOULDBLOCK:
                                return (0);
-#if defined(sun) && !defined(BSD)
+#if defined(sun) && !defined(BSD) && !defined(__svr4__) && !defined(__SVR4)
                        /*
                         * Due to a SunOS bug, after 2^31 bytes, the kernel
                         * file offset overflows and read fails with EINVAL.