]> The Tcpdump Group git mirrors - libpcap/commitdiff
Retire Tru64 UNIX and Ultrix support. 1263/head
authorDenis Ovsienko <[email protected]>
Sat, 27 Jan 2024 22:31:41 +0000 (22:31 +0000)
committerDenis Ovsienko <[email protected]>
Sat, 27 Jan 2024 22:35:36 +0000 (22:35 +0000)
The last Tru64 UNIX release was in 2010, the last Ultrix release was in
1995; both operating systems have Packet Filter as the packet capture
interface.  See also commits f377e14d4c9c24 and 25eb65a.

In extract.h leave the condition that tests for __alpha or __alpha__
intact because Linux, NetBSD and OpenBSD still support Alpha hardware.

13 files changed:
CMakeLists.txt
INSTALL.md
Makefile.in
README.md
aclocal.m4
cmakeconfig.h.in
configure.ac
gencode.c
nametoaddr.c
pcap-pf.c [deleted file]
pcap.3pcap.in
pcap_breakloop.3pcap
pcap_set_immediate_mode.3pcap.in

index 4296d787168255b285557622e14661480c976084..e6a30353ae5ebcad3f9768e3f2e1f924101549e3 100644 (file)
@@ -1887,7 +1887,6 @@ else()
                 check_symbol_exists(BIOCSETIF "sys/types.h;sys/time.h;sys/ioctl.h;sys/socket.h;net/bpf.h;net/if.h" BPF_H_DEFINES_BIOCSETIF)
             endif(HAVE_SYS_IOCCOM_H)
         endif(HAVE_NET_BPF_H)
-        check_include_file(net/pfilt.h HAVE_NET_PFILT_H)
         check_include_file(linux/socket.h HAVE_LINUX_SOCKET_H)
         check_include_file(net/raw.h HAVE_NET_RAW_H)
         check_include_file(sys/dlpi.h HAVE_SYS_DLPI_H)
@@ -1905,11 +1904,6 @@ else()
             # No prizes for guessing this one.
             #
             set(PCAP_TYPE linux)
-        elseif(HAVE_NET_PFILT_H)
-            #
-            # DEC OSF/1, Digital UNIX, Tru64 UNIX
-            #
-            set(PCAP_TYPE pf)
         elseif(HAVE_NET_RAW_H)
             #
             # IRIX snoop.
@@ -3052,16 +3046,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "IRIX" OR CMAKE_SYSTEM_NAME STREQUAL "IRIX64")
     #
     set(MAN_FILE_FORMATS 4)
     set(MAN_MISC_INFO 5)
-elseif(CMAKE_SYSTEM_NAME STREQUAL "OSF1")
-    #
-    # DEC OSF/1, a/k/a Digital UNIX, a/k/a Tru64 UNIX.
-    # Use Tru64 UNIX conventions for man pages; they're the same as the
-    # System V conventions except that they use section 8 for
-    # administrative commands and daemons.
-    #
-    set(MAN_FILE_FORMATS 4)
-    set(MAN_MISC_INFO 5)
-    set(MAN_DEVICES 7)
 elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
     #
     # SunOS 5.x.
@@ -3476,12 +3460,6 @@ if(NOT MSVC)
     # default, added to the run-time search path, so we don't need to
     # supply them.
     #
-    # For Tru64 UNIX, "-rpath" works with DEC's^WCompaq's^WHP's C
-    # compiler for Alpha, but isn't documented as working with GCC, and
-    # no GCC-compatible option is documented as working with the DEC
-    # compiler.  If anybody needs this on Tru64/Alpha, they're welcome
-    # to figure out a way to make it work.
-    #
     # This must *not* depend on the compiler, as, on platforms where
     # there's a GCC-compatible compiler and a vendor compiler, we need
     # to work with both.
index d5137a94575f211e1ea1951e40def18630499e18..c3717e489e7c257a8f0be69c8d3603c3c9c64bbe 100644 (file)
@@ -294,7 +294,6 @@ in `/usr/include/sys/dlpi.h`, and find the corresponding value.
        pcap-netmap.h       - netmap support
        pcap-npf.c          - Npcap capture support
        pcap-null.c         - dummy monitor support (allows offline use of libpcap)
-       pcap-pf.c           - Ultrix and Digital/Tru64 UNIX Packet Filter support
        pcap-rdmasniff.c    - RDMA/InfiniBand capture support
        pcap-rdmasniff.h    - RDMA/InfiniBand capture support
        pcap-rpcap.c        - RPCAP protocol capture support
index 807e8e8b4f4b3d987a35337f12a4b411b5e7f203..ceb96af3c11cfc09e9fa2dc0bb20911085a54c8c 100644 (file)
@@ -326,7 +326,6 @@ EXTRA_DIST = \
        pcap-netmap.h \
        pcap-npf.c \
        pcap-null.c \
-       pcap-pf.c \
        pcap-rdmasniff.c \
        pcap-rdmasniff.h \
        pcap-rpcap.c \
index e38b9a15d6b3c5e5d49107f6c40a534ffa707414..3bb9af73c45618714ce02da912782ffe80066ed5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -53,9 +53,7 @@ with the underlying kernel subsystem, but this is not yet implemented.
 
 BPF is standard in 4.4BSD, BSD/OS, NetBSD, FreeBSD, OpenBSD, DragonFly
 BSD, macOS, and Solaris 11; an older, modified and undocumented version
-is standard in AIX.  {DEC OSF/1, Digital UNIX, Tru64 UNIX} uses the
-packetfilter interface but has been extended to accept BPF filters
-(which libpcap utilizes).
+is standard in AIX.
 
 Linux has a number of BPF based systems, and libpcap does not support
 any of the eBPF mechanisms as yet, although it supports many of the
index 34594aa6c7662e4594b00c344e9173ecb1aa4187..a2ee768f5bdeee3d78225dd752523006332a8d1a 100644 (file)
@@ -160,28 +160,6 @@ AC_DEFUN(AC_LBL_C_INIT,
                    $1="$$1 -xansi -signed -g3"
                    ;;
 
-           osf*)
-                   #
-                   # Presumed to be DEC OSF/1, Digital UNIX, or
-                   # Tru64 UNIX.
-                   #
-                   # The DEC C compiler, which is what we presume we're
-                   # using, doesn't exit with a non-zero exit status if we
-                   # hand it an invalid -W flag, can't be forced to do
-                   # so, and doesn't handle GCC-style -W flags, so we
-                   # don't want to try using GCC-style -W flags.
-                   #
-                   ac_lbl_cc_dont_try_gcc_dashW=yes
-                   #
-                   # -g is equivalent to -g2, which turns off
-                   # optimization; we choose -g3, which generates
-                   # debugging information but doesn't turn off
-                   # optimization (even if the optimization would
-                   # cause inaccuracies in debugging).
-                   #
-                   $1="$$1 -g3"
-                   ;;
-
            solaris*)
                    #
                    # Assumed to be Sun C, which requires -errwarn to force
@@ -351,9 +329,9 @@ AC_DEFUN(AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT,
                #
                case "$host_os" in
 
-               irix*|osf*|darwin*)
+               irix*|darwin*)
                        #
-                       # MIPS C for IRIX, DEC C, and clang all use -M.
+                       # MIPS C for IRIX and Clang use -M.
                        #
                        ac_lbl_dependency_flag="-M"
                        ;;
@@ -461,7 +439,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
            aix*)
                    ;;
 
-           freebsd*|netbsd*|openbsd*|dragonfly*|linux*|osf*|haiku*|midipix*|gnu*)
+           freebsd*|netbsd*|openbsd*|dragonfly*|linux*|haiku*|midipix*|gnu*)
                    #
                    # Platforms where the C compiler is GCC or accepts
                    # compatible command-line arguments, and the linker
@@ -571,16 +549,6 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
                    #
                    ;;
 
-           osf*)
-                   #
-                   # Presumed to be DEC OSF/1, Digital UNIX, or
-                   # Tru64 UNIX.
-                   #
-                   V_SHLIB_CMD="\$(CC)"
-                   V_SHLIB_OPT="-shared"
-                   V_SONAME_OPT="-soname "
-                   ;;
-
            solaris*)
                    V_SHLIB_CCOPT="$V_SHLIB_CCOPT -Kpic"
                    V_SHLIB_CMD="\$(CC)"
index 162a1af319f0bc972d99fbd8230c0c5a716006f4..f1fece811775ebd16fc884b7db4e2243609ee74b 100644 (file)
 /* Define to 1 if you have the <net/if_media.h> header file. */
 #cmakedefine HAVE_NET_IF_MEDIA_H 1
 
-/* Define to 1 if you have the <net/pfilt.h> header file. */
-#cmakedefine HAVE_NET_PFILT_H 1
-
 /* Define to 1 if you have the <net/raw.h> header file. */
 #cmakedefine HAVE_NET_RAW_H 1
 
index 2765650fe19bfe815eecfc38ad159ebede66fd11..af18a2ea1d8b3037fa61a11730e020ee4a978b09 100644 (file)
@@ -733,7 +733,6 @@ else
                        [ac_cv_lbl_bpf_h_defines_biocsetif=no]))
                AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
        fi
-       AC_CHECK_HEADERS(net/pfilt.h)
        AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h)
        AC_CHECK_HEADERS(config/HaikuConfig.h)
        AC_CHECK_HEADERS(hurd.h)
@@ -763,11 +762,6 @@ else
                #
                V_PCAP=linux
                VALGRINDTEST_SRC=valgrindtest.c
-       elif test "$ac_cv_header_net_pfilt_h" = yes; then
-               #
-               # DEC OSF/1, Digital UNIX, Tru64 UNIX
-               #
-               V_PCAP=pf
        elif test "$ac_cv_header_net_raw_h" = yes; then
                #
                # IRIX snoop.
@@ -1113,13 +1107,6 @@ bpf)
        fi
        ;;
 
-pf)
-       #
-       # Capture module
-       #
-       PLATFORM_C_SRC="pcap-pf.c"
-       ;;
-
 snoop)
        #
        # Capture module
@@ -2400,20 +2387,6 @@ linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*|midipix*)
        DYEXT="so"
        ;;
 
-osf*)
-       DYEXT="so"
-
-       #
-       # DEC OSF/1, a/k/a Digital UNIX, a/k/a Tru64 UNIX.
-       # Use Tru64 UNIX conventions for man pages; they're the same as
-       # the System V conventions except that they use section 8 for
-       # administrative commands and daemons.
-       #
-       MAN_FILE_FORMATS=4
-       MAN_MISC_INFO=5
-       MAN_DEVICES=7
-       ;;
-
 solaris*)
        AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
 
@@ -3112,12 +3085,6 @@ fi
 # With the HP-UX linker, directories specified with -L are, by default,
 # added to the run-time search path, so we don't need to supply them.
 #
-# For Tru64 UNIX, "-rpath" works with DEC's^WCompaq's^WHP's C compiler
-# for Alpha, but isn't documented as working with GCC, and no GCC-
-# compatible option is documented as working with the DEC compiler.
-# If anybody needs this on Tru64/Alpha, they're welcome to figure out a
-# way to make it work.
-#
 # This must *not* depend on the compiler, as, on platforms where there's
 # a GCC-compatible compiler and a vendor compiler, we need to work with
 # both.
index 425eb3a52ef901bb75560a7febc9b943ff2a52f0..d3c79e9246c9975091cbcdc55e351435510eb1ff 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -6864,15 +6864,6 @@ stringtoport(compiler_state_t *cstate, const char *string, size_t string_size,
                        free(cpy);
                        break;
                }
-#if defined(ultrix) || defined(__osf__)
-               /* Special hack in case NFS isn't in /etc/services */
-               if (strcmp(cpy, "nfs") == 0) {
-                       val = 2049;
-                       *proto = PROTO_UNDEF;
-                       free(cpy);
-                       break;
-               }
-#endif
                bpf_set_error(cstate, "'%s' is not a valid port", cpy);
                free(cpy);
                longjmp(cstate->top_ctx, 1);
index 42f309d3c905d7b1112766be412f1fe27ba84387..35ec11017b32e660dac2fffc372545584a3c2935 100644 (file)
@@ -298,7 +298,7 @@ pcap_nametonetaddr(const char *name)
         * getnetbyname() that uses thread-specific data, in which
         * case we're thread-safe (sufficiently recent FreeBSD,
         * sufficiently recent Darwin-based OS, sufficiently recent
-        * HP-UX, sufficiently recent Tru64 UNIX), or we have the
+        * HP-UX, or we have the
         * traditional getnetbyname() (everything else, including
         * current NetBSD and OpenBSD), in which case we're not
         * thread-safe.
@@ -448,14 +448,6 @@ pcap_nametoport(const char *name, int *port, int *proto)
                *proto = IPPROTO_UDP;
                return 1;
        }
-#if defined(ultrix) || defined(__osf__)
-       /* Special hack in case NFS isn't in /etc/services */
-       if (strcmp(name, "nfs") == 0) {
-               *port = 2049;
-               *proto = PROTO_UNDEF;
-               return 1;
-       }
-#endif
        return 0;
 }
 
@@ -547,7 +539,7 @@ pcap_nametoproto(const char *str)
         * getprotobyname() that uses thread-specific data, in which
         * case we're thread-safe (sufficiently recent FreeBSD,
         * sufficiently recent Darwin-based OS, sufficiently recent
-        * HP-UX, sufficiently recent Tru64 UNIX, Windows), or we have
+        * HP-UX, Windows), or we have
         * the traditional getprotobyname() (everything else, including
         * current NetBSD and OpenBSD), in which case we're not
         * thread-safe.
diff --git a/pcap-pf.c b/pcap-pf.c
deleted file mode 100644 (file)
index 49322c8..0000000
--- a/pcap-pf.c
+++ /dev/null
@@ -1,682 +0,0 @@
-/*
- * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that: (1) source code distributions
- * retain the above copyright notice and this paragraph in its entirety, (2)
- * distributions including binary code include the above copyright notice and
- * this paragraph in its entirety in the documentation or other materials
- * provided with the distribution, and (3) all advertising materials mentioning
- * features or use of this software display the following acknowledgement:
- * ``This product includes software developed by the University of California,
- * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
- * the University nor the names of its contributors may be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * packet filter subroutines for tcpdump
- *     Extraction/creation by Jeffrey Mogul, DECWRL
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/timeb.h>
-#include <sys/socket.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <net/pfilt.h>
-
-struct mbuf;
-struct rtentry;
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#include <netinet/ip_var.h>
-#include <netinet/udp.h>
-#include <netinet/udp_var.h>
-#include <netinet/tcp.h>
-#include <netinet/tcpip.h>
-
-#include <errno.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-/*
- * Make "pcap.h" not include "pcap/bpf.h"; we are going to include the
- * native OS version, as we need various BPF ioctls from it.
- */
-#define PCAP_DONT_INCLUDE_PCAP_BPF_H
-#include <net/bpf.h>
-
-#include "pcap-int.h"
-
-#ifdef HAVE_OS_PROTO_H
-#include "os-proto.h"
-#endif
-
-/*
- * FDDI packets are padded to make everything line up on a nice boundary.
- */
-#define       PCAP_FDDIPAD 3
-
-/*
- * Private data for capturing on Ultrix and DEC OSF/1^WDigital UNIX^W^W
- * Tru64 UNIX packetfilter devices.
- */
-struct pcap_pf {
-       int     filtering_in_kernel; /* using kernel filter */
-       u_long  TotPkts;        /* can't overflow for 79 hrs on ether */
-       u_long  TotAccepted;    /* count accepted by filter */
-       u_long  TotDrops;       /* count of dropped packets */
-       long    TotMissed;      /* missed by i/f during this run */
-       long    OrigMissed;     /* missed by i/f before this run */
-};
-
-static int pcap_setfilter_pf(pcap_t *, struct bpf_program *);
-
-/*
- * BUFSPACE is the size in bytes of the packet read buffer.  Most tcpdump
- * applications aren't going to need more than 200 bytes of packet header
- * and the read shouldn't return more packets than packetfilter's internal
- * queue limit (bounded at 256).
- */
-#define BUFSPACE (200 * 256)
-
-static int
-pcap_read_pf(pcap_t *pc, int cnt, pcap_handler callback, u_char *user)
-{
-       struct pcap_pf *pf = pc->priv;
-       register u_char *p, *bp;
-       register int cc, n, buflen, inc;
-       register struct enstamp *sp;
-       struct enstamp stamp;
-       register u_int pad;
-
- again:
-       cc = pc->cc;
-       if (cc == 0) {
-               cc = read(pc->fd, (char *)pc->buffer + pc->offset, pc->bufsize);
-               if (cc < 0) {
-                       if (errno == EWOULDBLOCK)
-                               return (0);
-                       if (errno == EINVAL &&
-                           lseek(pc->fd, 0L, SEEK_CUR) + pc->bufsize < 0) {
-                               /*
-                                * Due to a kernel bug, after 2^31 bytes,
-                                * the kernel file offset overflows and
-                                * read fails with EINVAL. The lseek()
-                                * to 0 will fix things.
-                                */
-                               (void)lseek(pc->fd, 0L, SEEK_SET);
-                               goto again;
-                       }
-                       pcapint_fmt_errmsg_for_errno(pc->errbuf,
-                           sizeof(pc->errbuf), errno, "pf read");
-                       return (-1);
-               }
-               bp = pc->buffer + pc->offset;
-       } else
-               bp = pc->bp;
-       /*
-        * Loop through each packet.
-        *
-        * This assumes that a single buffer of packets will have
-        * <= INT_MAX packets, so the packet count doesn't overflow.
-        */
-       n = 0;
-       pad = pc->fddipad;
-       while (cc > 0) {
-               /*
-                * Has "pcap_breakloop()" been called?
-                * If so, return immediately - if we haven't read any
-                * packets, clear the flag and return -2 to indicate
-                * that we were told to break out of the loop, otherwise
-                * leave the flag set, so that the *next* call will break
-                * out of the loop without having read any packets, and
-                * return the number of packets we've processed so far.
-                */
-               if (pc->break_loop) {
-                       if (n == 0) {
-                               pc->break_loop = 0;
-                               return (-2);
-                       } else {
-                               pc->cc = cc;
-                               pc->bp = bp;
-                               return (n);
-                       }
-               }
-               if (cc < sizeof(*sp)) {
-                       snprintf(pc->errbuf, sizeof(pc->errbuf),
-                           "pf short read (%d)", cc);
-                       return (-1);
-               }
-               if ((long)bp & 3) {
-                       sp = &stamp;
-                       memcpy((char *)sp, (char *)bp, sizeof(*sp));
-               } else
-                       sp = (struct enstamp *)bp;
-               if (sp->ens_stamplen != sizeof(*sp)) {
-                       snprintf(pc->errbuf, sizeof(pc->errbuf),
-                           "pf short stamplen (%d)",
-                           sp->ens_stamplen);
-                       return (-1);
-               }
-
-               p = bp + sp->ens_stamplen;
-               buflen = sp->ens_count;
-               if (buflen > pc->snapshot)
-                       buflen = pc->snapshot;
-
-               /* Calculate inc before possible pad update */
-               inc = ENALIGN(buflen + sp->ens_stamplen);
-               cc -= inc;
-               bp += inc;
-               pf->TotPkts++;
-               pf->TotDrops += sp->ens_dropped;
-               pf->TotMissed = sp->ens_ifoverflows;
-               if (pf->OrigMissed < 0)
-                       pf->OrigMissed = pf->TotMissed;
-
-               /*
-                * Short-circuit evaluation: if using BPF filter
-                * in kernel, no need to do it now - we already know
-                * the packet passed the filter.
-                *
-                * Note: the filter code was generated assuming
-                * that pc->fddipad was the amount of padding
-                * before the header, as that's what's required
-                * in the kernel, so we run the filter before
-                * skipping that padding.
-                */
-               if (pf->filtering_in_kernel ||
-                   pcapint_filter(pc->fcode.bf_insns, p, sp->ens_count, buflen)) {
-                       struct pcap_pkthdr h;
-                       pf->TotAccepted++;
-                       h.ts = sp->ens_tstamp;
-                       h.len = sp->ens_count - pad;
-                       p += pad;
-                       buflen -= pad;
-                       h.caplen = buflen;
-                       (*callback)(user, &h, p);
-                       if (++n >= cnt && !PACKET_COUNT_IS_UNLIMITED(cnt)) {
-                               pc->cc = cc;
-                               pc->bp = bp;
-                               return (n);
-                       }
-               }
-       }
-       pc->cc = 0;
-       return (n);
-}
-
-static int
-pcap_inject_pf(pcap_t *p, const void *buf, int size)
-{
-       int ret;
-
-       ret = write(p->fd, buf, size);
-       if (ret == -1) {
-               pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                   errno, "send");
-               return (-1);
-       }
-       return (ret);
-}
-
-static int
-pcap_stats_pf(pcap_t *p, struct pcap_stat *ps)
-{
-       struct pcap_pf *pf = p->priv;
-
-       /*
-        * If packet filtering is being done in the kernel:
-        *
-        *      "ps_recv" counts only packets that passed the filter.
-        *      This does not include packets dropped because we
-        *      ran out of buffer space.  (XXX - perhaps it should,
-        *      by adding "ps_drop" to "ps_recv", for compatibility
-        *      with some other platforms.  On the other hand, on
-        *      some platforms "ps_recv" counts only packets that
-        *      passed the filter, and on others it counts packets
-        *      that didn't pass the filter....)
-        *
-        *      "ps_drop" counts packets that passed the kernel filter
-        *      (if any) but were dropped because the input queue was
-        *      full.
-        *
-        *      "ps_ifdrop" counts packets dropped by the network
-        *      interface (regardless of whether they would have passed
-        *      the input filter, of course).
-        *
-        * If packet filtering is not being done in the kernel:
-        *
-        *      "ps_recv" counts only packets that passed the filter.
-        *
-        *      "ps_drop" counts packets that were dropped because the
-        *      input queue was full, regardless of whether they passed
-        *      the userland filter.
-        *
-        *      "ps_ifdrop" counts packets dropped by the network
-        *      interface (regardless of whether they would have passed
-        *      the input filter, of course).
-        *
-        * These statistics don't include packets not yet read from
-        * the kernel by libpcap, but they may include packets not
-        * yet read from libpcap by the application.
-        */
-       ps->ps_recv = pf->TotAccepted;
-       ps->ps_drop = pf->TotDrops;
-       ps->ps_ifdrop = pf->TotMissed - pf->OrigMissed;
-       return (0);
-}
-
-/*
- * We include the OS's <net/bpf.h>, not our "pcap/bpf.h", so we probably
- * don't get DLT_DOCSIS defined.
- */
-#ifndef DLT_DOCSIS
-#define DLT_DOCSIS     143
-#endif
-
-static int
-pcap_activate_pf(pcap_t *p)
-{
-       struct pcap_pf *pf = p->priv;
-       short enmode;
-       int backlog = -1;       /* request the most */
-       struct enfilter Filter;
-       struct endevp devparams;
-       int err;
-
-       /*
-        * Initially try a read/write open (to allow the inject
-        * method to work).  If that fails due to permission
-        * issues, fall back to read-only.  This allows a
-        * non-root user to be granted specific access to pcap
-        * capabilities via file permissions.
-        *
-        * XXX - we should have an API that has a flag that
-        * controls whether to open read-only or read-write,
-        * so that denial of permission to send (or inability
-        * to send, if sending packets isn't supported on
-        * the device in question) can be indicated at open
-        * time.
-        *
-        * XXX - we assume here that "pfopen()" does not, in fact, modify
-        * its argument, even though it takes a "char *" rather than a
-        * "const char *" as its first argument.  That appears to be
-        * the case, at least on Digital UNIX 4.0.
-        *
-        * XXX - is there an error that means "no such device"?  Is
-        * there one that means "that device doesn't support pf"?
-        */
-       p->fd = pfopen(p->opt.device, O_RDWR);
-       if (p->fd == -1 && errno == EACCES)
-               p->fd = pfopen(p->opt.device, O_RDONLY);
-       if (p->fd < 0) {
-               if (errno == EACCES) {
-                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
-                           "pf open: %s: Permission denied\n"
-"your system may not be properly configured; see the packetfilter(4) man page",
-                           p->opt.device);
-                       err = PCAP_ERROR_PERM_DENIED;
-               } else {
-                       pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                           errno, "pf open: %s", p->opt.device);
-                       err = PCAP_ERROR;
-               }
-               goto bad;
-       }
-
-       /*
-        * Turn a negative snapshot value (invalid), a snapshot value of
-        * 0 (unspecified), or a value bigger than the normal maximum
-        * value, into the maximum allowed value.
-        *
-        * If some application really *needs* a bigger snapshot
-        * length, we should just increase MAXIMUM_SNAPLEN.
-        */
-       if (p->snapshot <= 0 || p->snapshot > MAXIMUM_SNAPLEN)
-               p->snapshot = MAXIMUM_SNAPLEN;
-
-       pf->OrigMissed = -1;
-       enmode = ENTSTAMP|ENNONEXCL;
-       if (!p->opt.immediate)
-               enmode |= ENBATCH;
-       if (p->opt.promisc)
-               enmode |= ENPROMISC;
-       if (ioctl(p->fd, EIOCMBIS, (caddr_t)&enmode) < 0) {
-               pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                   errno, "EIOCMBIS");
-               err = PCAP_ERROR;
-               goto bad;
-       }
-#ifdef ENCOPYALL
-       /* Try to set COPYALL mode so that we see packets to ourself */
-       enmode = ENCOPYALL;
-       (void)ioctl(p->fd, EIOCMBIS, (caddr_t)&enmode);/* OK if this fails */
-#endif
-       /* set the backlog */
-       if (ioctl(p->fd, EIOCSETW, (caddr_t)&backlog) < 0) {
-               pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                   errno, "EIOCSETW");
-               err = PCAP_ERROR;
-               goto bad;
-       }
-       /* discover interface type */
-       if (ioctl(p->fd, EIOCDEVP, (caddr_t)&devparams) < 0) {
-               pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                   errno, "EIOCDEVP");
-               err = PCAP_ERROR;
-               goto bad;
-       }
-       /* HACK: to compile prior to Ultrix 4.2 */
-#ifndef        ENDT_FDDI
-#define        ENDT_FDDI       4
-#endif
-       switch (devparams.end_dev_type) {
-
-       case ENDT_10MB:
-               p->linktype = DLT_EN10MB;
-               p->offset = 2;
-               /*
-                * This is (presumably) a real Ethernet capture; give it a
-                * link-layer-type list with DLT_EN10MB and DLT_DOCSIS, so
-                * that an application can let you choose it, in case you're
-                * capturing DOCSIS traffic that a Cisco Cable Modem
-                * Termination System is putting out onto an Ethernet (it
-                * doesn't put an Ethernet header onto the wire, it puts raw
-                * DOCSIS frames out on the wire inside the low-level
-                * Ethernet framing).
-                */
-               p->dlt_list = (u_int *) malloc(sizeof(u_int) * 2);
-               if (p->dlt_list == NULL) {
-                       pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                           errno, "malloc");
-                       err = PCAP_ERROR;
-                       goto bad;
-               }
-               p->dlt_list[0] = DLT_EN10MB;
-               p->dlt_list[1] = DLT_DOCSIS;
-               p->dlt_count = 2;
-               break;
-
-       case ENDT_FDDI:
-               p->linktype = DLT_FDDI;
-               break;
-
-#ifdef ENDT_SLIP
-       case ENDT_SLIP:
-               p->linktype = DLT_SLIP;
-               break;
-#endif
-
-#ifdef ENDT_PPP
-       case ENDT_PPP:
-               p->linktype = DLT_PPP;
-               break;
-#endif
-
-#ifdef ENDT_LOOPBACK
-       case ENDT_LOOPBACK:
-               /*
-                * It appears to use Ethernet framing, at least on
-                * Digital UNIX 4.0.
-                */
-               p->linktype = DLT_EN10MB;
-               p->offset = 2;
-               break;
-#endif
-
-#ifdef ENDT_TRN
-       case ENDT_TRN:
-               p->linktype = DLT_IEEE802;
-               break;
-#endif
-
-       default:
-               /*
-                * XXX - what about ENDT_IEEE802?  The pfilt.h header
-                * file calls this "IEEE 802 networks (non-Ethernet)",
-                * but that doesn't specify a specific link layer type;
-                * it could be 802.4, or 802.5 (except that 802.5 is
-                * ENDT_TRN), or 802.6, or 802.11, or....  That's why
-                * DLT_IEEE802 was hijacked to mean Token Ring in various
-                * BSDs, and why we went along with that hijacking.
-                *
-                * XXX - what about ENDT_HDLC and ENDT_NULL?
-                * Presumably, as ENDT_OTHER is just "Miscellaneous
-                * framing", there's not much we can do, as that
-                * doesn't specify a particular type of header.
-                */
-               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
-                   "unknown data-link type %u", devparams.end_dev_type);
-               err = PCAP_ERROR;
-               goto bad;
-       }
-       /* set truncation */
-       if (p->linktype == DLT_FDDI) {
-               p->fddipad = PCAP_FDDIPAD;
-
-               /* packetfilter includes the padding in the snapshot */
-               p->snapshot += PCAP_FDDIPAD;
-       } else
-               p->fddipad = 0;
-       if (ioctl(p->fd, EIOCTRUNCATE, (caddr_t)&p->snapshot) < 0) {
-               pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                   errno, "EIOCTRUNCATE");
-               err = PCAP_ERROR;
-               goto bad;
-       }
-       /* accept all packets */
-       memset(&Filter, 0, sizeof(Filter));
-       Filter.enf_Priority = 37;       /* anything > 2 */
-       Filter.enf_FilterLen = 0;       /* means "always true" */
-       if (ioctl(p->fd, EIOCSETF, (caddr_t)&Filter) < 0) {
-               pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                   errno, "EIOCSETF");
-               err = PCAP_ERROR;
-               goto bad;
-       }
-
-       if (p->opt.timeout != 0) {
-               struct timeval timeout;
-               timeout.tv_sec = p->opt.timeout / 1000;
-               timeout.tv_usec = (p->opt.timeout * 1000) % 1000000;
-               if (ioctl(p->fd, EIOCSRTIMEOUT, (caddr_t)&timeout) < 0) {
-                       pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                           errno, "EIOCSRTIMEOUT");
-                       err = PCAP_ERROR;
-                       goto bad;
-               }
-       }
-
-       p->bufsize = BUFSPACE;
-       p->buffer = malloc(p->bufsize + p->offset);
-       if (p->buffer == NULL) {
-               pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
-                   errno, "malloc");
-               err = PCAP_ERROR;
-               goto bad;
-       }
-
-       /*
-        * "select()" and "poll()" work on packetfilter devices.
-        */
-       p->selectable_fd = p->fd;
-
-       p->read_op = pcap_read_pf;
-       p->inject_op = pcap_inject_pf;
-       p->setfilter_op = pcap_setfilter_pf;
-       p->setdirection_op = NULL;      /* Not implemented. */
-       p->set_datalink_op = NULL;      /* can't change data link type */
-       p->getnonblock_op = pcapint_getnonblock_fd;
-       p->setnonblock_op = pcapint_setnonblock_fd;
-       p->stats_op = pcap_stats_pf;
-
-       return (0);
- bad:
-       pcapint_cleanup_live_common(p);
-       return (err);
-}
-
-pcap_t *
-pcapint_create_interface(const char *device _U_, char *ebuf)
-{
-       pcap_t *p;
-
-       p = PCAP_CREATE_COMMON(ebuf, struct pcap_pf);
-       if (p == NULL)
-               return (NULL);
-
-       p->activate_op = pcap_activate_pf;
-       return (p);
-}
-
-/*
- * XXX - is there an error from pfopen() that means "no such device"?
- * Is there one that means "that device doesn't support pf"?
- */
-static int
-can_be_bound(const char *name _U_)
-{
-       return (1);
-}
-
-static int
-get_if_flags(const char *name _U_, bpf_u_int32 *flags _U_, char *errbuf _U_)
-{
-       /*
-        * Nothing we can do other than mark loopback devices as "the
-        * connected/disconnected status doesn't apply".
-        *
-        * XXX - is there a way to find out whether an adapter has
-        * something plugged into it?
-        */
-       if (*flags & PCAP_IF_LOOPBACK) {
-               /*
-                * Loopback devices aren't wireless, and "connected"/
-                * "disconnected" doesn't apply to them.
-                */
-               *flags |= PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE;
-               return (0);
-       }
-       return (0);
-}
-
-int
-pcapint_platform_finddevs(pcap_if_list_t *devlistp, char *errbuf)
-{
-       return (pcapint_findalldevs_interfaces(devlistp, errbuf, can_be_bound,
-           get_if_flags));
-}
-
-static int
-pcap_setfilter_pf(pcap_t *p, struct bpf_program *fp)
-{
-       struct pcap_pf *pf = p->priv;
-       struct bpf_version bv;
-
-       /*
-        * See if BIOCVERSION works.  If not, we assume the kernel doesn't
-        * support BPF-style filters (it's not documented in the bpf(7)
-        * or packetfilter(7) man pages, but the code used to fail if
-        * BIOCSETF worked but BIOCVERSION didn't, and I've seen it do
-        * kernel filtering in DU 4.0, so presumably BIOCVERSION works
-        * there, at least).
-        */
-       if (ioctl(p->fd, BIOCVERSION, (caddr_t)&bv) >= 0) {
-               /*
-                * OK, we have the version of the BPF interpreter;
-                * is it the same major version as us, and the same
-                * or better minor version?
-                */
-               if (bv.bv_major == BPF_MAJOR_VERSION &&
-                   bv.bv_minor >= BPF_MINOR_VERSION) {
-                       /*
-                        * Yes.  Try to install the filter.
-                        */
-                       if (ioctl(p->fd, BIOCSETF, (caddr_t)fp) < 0) {
-                               pcapint_fmt_errmsg_for_errno(p->errbuf,
-                                   sizeof(p->errbuf), errno, "BIOCSETF");
-                               return (-1);
-                       }
-
-                       /*
-                        * OK, that succeeded.  We're doing filtering in
-                        * the kernel.  (We assume we don't have a
-                        * userland filter installed - that'd require
-                        * a previous version check to have failed but
-                        * this one to succeed.)
-                        *
-                        * XXX - this message should be supplied to the
-                        * application as a warning of some sort,
-                        * except that if it's a GUI application, it's
-                        * not clear that it should be displayed in
-                        * a window to annoy the user.
-                        */
-                       fprintf(stderr, "tcpdump: Using kernel BPF filter\n");
-                       pf->filtering_in_kernel = 1;
-
-                       /*
-                        * Discard any previously-received packets,
-                        * as they might have passed whatever filter
-                        * was formerly in effect, but might not pass
-                        * this filter (BIOCSETF discards packets buffered
-                        * in the kernel, so you can lose packets in any
-                        * case).
-                        */
-                       p->cc = 0;
-                       return (0);
-               }
-
-               /*
-                * We can't use the kernel's BPF interpreter; don't give
-                * up, just log a message and be inefficient.
-                *
-                * XXX - this should really be supplied to the application
-                * as a warning of some sort.
-                */
-               fprintf(stderr,
-           "tcpdump: Requires BPF language %d.%d or higher; kernel is %d.%d\n",
-                   BPF_MAJOR_VERSION, BPF_MINOR_VERSION,
-                   bv.bv_major, bv.bv_minor);
-       }
-
-       /*
-        * We couldn't do filtering in the kernel; do it in userland.
-        */
-       if (pcapint_install_bpf_program(p, fp) < 0)
-               return (-1);
-
-       /*
-        * XXX - this message should be supplied by the application as
-        * a warning of some sort.
-        */
-       fprintf(stderr, "tcpdump: Filtering in user process\n");
-       pf->filtering_in_kernel = 0;
-       return (0);
-}
-
-/*
- * Libpcap version string.
- */
-const char *
-pcap_lib_version(void)
-{
-       return (PCAP_VERSION_STRING);
-}
index ab84d26e5cd71b906bc0f40a8f89f0a2d6d92c8e..7d4f88ee0158e873b096f84d18831d3538b5ed0f 100644 (file)
@@ -321,22 +321,6 @@ those capability bits to be given to particular accounts and to cause
 those bits to be set on a user's initial processes when they log in, in
 which case you must have CAP_NET_RAW in order to capture.
 .TP
-.B Under ULTRIX and Digital UNIX/Tru64 UNIX:
-Any user may capture network traffic.
-However, no user (not even the super-user) can capture in promiscuous
-mode on an interface unless the super-user has enabled promiscuous-mode
-operation on that interface using
-.IR pfconfig (8),
-and no user (not even the super-user) can capture unicast traffic
-received by or sent by the machine on an interface unless the super-user
-has enabled copy-all-mode operation on that interface using
-.IR pfconfig ,
-so
-.I useful
-packet capture on an interface probably requires that either
-promiscuous-mode or copy-all-mode operation, or both modes of
-operation, be enabled on that interface.
-.TP
 .B Under BSD (this includes macOS):
 You must have read access to
 .I /dev/bpf*
index b5e5988373ba6b6b88cf1a1cf2e5aadf9d5a7185..ebea878c75a3df56342503d248e7501abdaa04c0 100644 (file)
@@ -84,7 +84,7 @@ If a non-zero packet buffer timeout is set on the
 and you are capturing on a network interface, the thread will be
 unblocked with the timeout expires.  This is not guaranteed to happen
 unless at least one packet has arrived; the only platforms on which it
-happens are macOS, the BSDs, Solaris 11, AIX, Tru64 UNIX, and Windows.
+happens are macOS, the BSDs, Solaris 11, AIX, and Windows.
 .PP
 If you want to ensure that the loop will eventually be unblocked on any
 other platforms, or unblocked when capturing on a device other than a
index 95c9cffbded73a0ca5c096245307e13b34739747..ff15600e2e75649408af114d4eb75e3c699d6df3 100644 (file)
@@ -68,19 +68,6 @@ turned on by using a read timeout of 0 when opening the device (this
 will not provide immediate delivery of packets on other platforms, so
 don't assume it's sufficient);
 .IP
-on Digital UNIX/Tru64 UNIX, immediate mode must be turned on by doing a
-.B BIOCMBIC
-.BR ioctl (),
-as documented in
-.BR packetfilter (7),
-to clear the
-.B ENBATCH
-flag on the descriptor returned by
-.BR pcap_fileno (3PCAP),
-after
-.BR pcap_activate (3PCAP)
-is called;
-.IP
 on Windows, immediate mode must be turned on by calling
 .BR pcap_setmintocopy ()
 with a size of 0.