]> The Tcpdump Group git mirrors - libpcap/commitdiff
Add DLT_ARCNET_LINUX and LINKTYPE_ARCNET_LINUX; the link-layer headers
authorguy <guy>
Tue, 21 Jan 2003 04:39:05 +0000 (04:39 +0000)
committerguy <guy>
Tue, 21 Jan 2003 04:39:05 +0000 (04:39 +0000)
supplied by Linux's ARCNET code aren't the same as the ones supplied by
NetBSD's ARCNET code.

Fix up some LINKTYPE_ values to match the corresponding DLT_ values.
(There is no released version of libpcap/tcpdump that supports their
previous values.)

bpf/net/bpf.h
savefile.c

index a99311984ad6235e2b267c2d560652f0a9f8365b..62a5300759d462ad910d1f79f94707a78f864bd2 100644 (file)
@@ -37,7 +37,7 @@
  *
  *      @(#)bpf.h       7.1 (Berkeley) 5/7/91
  *
  *
  *      @(#)bpf.h       7.1 (Berkeley) 5/7/91
  *
- * @(#) $Header: /tcpdump/master/libpcap/bpf/net/Attic/bpf.h,v 1.65 2002-12-26 08:53:07 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/bpf/net/Attic/bpf.h,v 1.66 2003-01-21 04:39:05 guy Exp $ (LBL)
  */
 
 #ifndef BPF_MAJOR_VERSION
  */
 
 #ifndef BPF_MAJOR_VERSION
@@ -183,7 +183,7 @@ struct bpf_hdr {
 #define DLT_PRONET     4       /* Proteon ProNET Token Ring */
 #define DLT_CHAOS      5       /* Chaos */
 #define DLT_IEEE802    6       /* IEEE 802 Networks */
 #define DLT_PRONET     4       /* Proteon ProNET Token Ring */
 #define DLT_CHAOS      5       /* Chaos */
 #define DLT_IEEE802    6       /* IEEE 802 Networks */
-#define DLT_ARCNET     7       /* ARCNET */
+#define DLT_ARCNET     7       /* ARCNET, with NetBSD-style header */
 #define DLT_SLIP       8       /* Serial Line IP */
 #define DLT_PPP                9       /* Point-to-point Protocol */
 #define DLT_FDDI       10      /* FDDI */
 #define DLT_SLIP       8       /* Serial Line IP */
 #define DLT_PPP                9       /* Point-to-point Protocol */
 #define DLT_FDDI       10      /* FDDI */
@@ -394,6 +394,19 @@ struct bpf_hdr {
  */
 #define DLT_TZSP                128     /* Tazmen Sniffer Protocol */
 
  */
 #define DLT_TZSP                128     /* Tazmen Sniffer Protocol */
 
+/*
+ * NetBSD's ARCNET headers have the source host, destination host,
+ * and type at the beginning of the packet; that's what's handed
+ * up to userland via BPF.
+ *
+ * Linux's ARCNET headers, however, have a 2-byte offset field
+ * between the host IDs and the type; that's what's handed up
+ * to userland via PF_PACKET sockets.
+ *
+ * We therefore have to have separate DLT_ values for them.
+ */
+#define DLT_ARCNET_LINUX       129     /* ARCNET */
+
 /*
  * The instruction encodings.
  */
 /*
  * The instruction encodings.
  */
index 79c3043af8117f96e35ec9fe59476d4ea862bae2..5d7bff706a4edf3fc989a8fc792e6cd9732de7d7 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.73 2002-12-26 08:53:07 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.74 2003-01-21 04:39:05 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -123,7 +123,7 @@ static const char rcsid[] =
 #define LINKTYPE_PRONET                DLT_PRONET
 #define LINKTYPE_CHAOS         DLT_CHAOS
 #define LINKTYPE_TOKEN_RING    DLT_IEEE802     /* DLT_IEEE802 is used for Token Ring */
 #define LINKTYPE_PRONET                DLT_PRONET
 #define LINKTYPE_CHAOS         DLT_CHAOS
 #define LINKTYPE_TOKEN_RING    DLT_IEEE802     /* DLT_IEEE802 is used for Token Ring */
-#define LINKTYPE_ARCNET                DLT_ARCNET
+#define LINKTYPE_ARCNET                DLT_ARCNET      /* NetBSD-style headers */
 #define LINKTYPE_SLIP          DLT_SLIP
 #define LINKTYPE_PPP           DLT_PPP
 #define LINKTYPE_FDDI          DLT_FDDI
 #define LINKTYPE_SLIP          DLT_SLIP
 #define LINKTYPE_PPP           DLT_PPP
 #define LINKTYPE_FDDI          DLT_FDDI
@@ -167,10 +167,12 @@ static const char rcsid[] =
 #define LINKTYPE_IP_OVER_FC    122             /* RFC 2625 IP-over-Fibre Channel */
 #define LINKTYPE_SUNATM                123             /* Solaris+SunATM */
 
 #define LINKTYPE_IP_OVER_FC    122             /* RFC 2625 IP-over-Fibre Channel */
 #define LINKTYPE_SUNATM                123             /* Solaris+SunATM */
 
-#define LINKTYPE_TZSP          126             /* Tazmen Sniffer Protocol */
-
 #define LINKTYPE_IEEE802_11_RADIO 127          /* 802.11 plus WLAN header */
 
 #define LINKTYPE_IEEE802_11_RADIO 127          /* 802.11 plus WLAN header */
 
+#define LINKTYPE_TZSP          128             /* Tazmen Sniffer Protocol */
+
+#define LINKTYPE_ARCNET_LINUX  129             /* Linux-style headers */
+
 /*
  * These types are reserved for future use.
  */
 /*
  * These types are reserved for future use.
  */
@@ -181,9 +183,9 @@ static const char rcsid[] =
 #define LINKTYPE_IPFILTER      116             /* IP Filter capture files */
 #define LINKTYPE_PFLOG         117             /* OpenBSD DLT_PFLOG */
 #define LINKTYPE_HHDLC         121             /* Siemens HiPath HDLC */
 #define LINKTYPE_IPFILTER      116             /* IP Filter capture files */
 #define LINKTYPE_PFLOG         117             /* OpenBSD DLT_PFLOG */
 #define LINKTYPE_HHDLC         121             /* Siemens HiPath HDLC */
-#define LINKTYPE_RIO           123             /* RapidIO */
-#define LINKTYPE_PCI_EXP       124             /* PCI Express */
-#define LINKTYPE_AURORA                125             /* Xilinx Aurora link layer */
+#define LINKTYPE_RIO           124             /* RapidIO */
+#define LINKTYPE_PCI_EXP       125             /* PCI Express */
+#define LINKTYPE_AURORA                126             /* Xilinx Aurora link layer */
 
 static struct linktype_map {
        int     dlt;
 
 static struct linktype_map {
        int     dlt;
@@ -284,11 +286,14 @@ static struct linktype_map {
        /* Xilinx Aurora link layer */
        { DLT_AURORA,           LINKTYPE_AURORA },
 
        /* Xilinx Aurora link layer */
        { DLT_AURORA,           LINKTYPE_AURORA },
 
+       /* 802.11 plus WLAN header */
+       { DLT_IEEE802_11_RADIO, LINKTYPE_IEEE802_11_RADIO },
+
        /* Tazmen Sniffer Protocol */
        { DLT_TZSP,             LINKTYPE_TZSP },
 
        /* Tazmen Sniffer Protocol */
        { DLT_TZSP,             LINKTYPE_TZSP },
 
-       /* 802.11 plus WLAN header */
-       { DLT_IEEE802_11_RADIO, LINKTYPE_IEEE802_11_RADIO },
+       /* Arcnet with Linux-style link-layer headers */
+       { DLT_ARCNET_LINUX,     LINKTYPE_ARCNET_LINUX },
 
        /*
         * Any platform that defines additional DLT_* codes should:
 
        /*
         * Any platform that defines additional DLT_* codes should: