]> The Tcpdump Group git mirrors - libpcap/commitdiff
Add support for OpenBSD DLT_ENC - and map it to a value of 109, as its
authorguy <guy>
Sat, 8 Mar 2003 08:42:13 +0000 (08:42 +0000)
committerguy <guy>
Sat, 8 Mar 2003 08:42:13 +0000 (08:42 +0000)
value in OpenBSD, 13, is Yet Another DLT_ Value That Other OSes Use For
Their Own Purposes.

gencode.c
pcap-bpf.h
savefile.c

index 790fcd2b830c121068f254ed28d5b7dc50c9f80d..1915d21dbf805e6e787ca02f98b6cc9ef296033c 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -21,7 +21,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.187 2003-03-08 08:23:47 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.188 2003-03-08 08:42:13 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -738,6 +738,12 @@ init_linktype(type)
                off_nl_nosnap = 4;      /* no 802.2 LLC */
                return;
 
+       case DLT_ENC:
+               off_linktype = 0;
+               off_nl = 12;
+               off_nl_nosnap = 12;     /* no 802.2 LLC */
+               return;
+
        case DLT_PPP:
        case DLT_C_HDLC:                /* BSD/OS Cisco HDLC */
        case DLT_PPP_SERIAL:            /* NetBSD sync/async serial PPP */
@@ -1523,9 +1529,13 @@ gen_linktype(proto)
 
        case DLT_NULL:
        case DLT_LOOP:
+       case DLT_ENC:
                /*
                 * For DLT_NULL, the link-layer header is a 32-bit
-                * word containing an AF_ value in *host* byte order.
+                * word containing an AF_ value in *host* byte order,
+                * and for DLT_ENC, the link-layer header begins
+                * with a 32-bit work containing an AF_ value in
+                * host byte order.
                 *
                 * In addition, if we're reading a saved capture file,
                 * the host byte order in the capture may not be the
@@ -1563,7 +1573,7 @@ gen_linktype(proto)
                        return gen_false();
                }
 
-               if (linktype == DLT_NULL) {
+               if (linktype == DLT_NULL || linktype == DLT_ENC) {
                        /*
                         * The AF_ value is in host byte order, but
                         * the BPF interpreter will convert it to
index dd53ceaf6272482b8fe0ae3e5c394e0968c0a028..87959628b4f6f0a37961564a28d14eb8ac562934 100644 (file)
@@ -37,7 +37,7 @@
  *
  *      @(#)bpf.h       7.1 (Berkeley) 5/7/91
  *
- * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.2 2003-02-11 17:03:22 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.3 2003-03-08 08:42:14 guy Exp $ (LBL)
  */
 
 /*
@@ -225,8 +225,15 @@ struct bpf_version {
 #define DLT_LOOP       108
 
 /*
- * Values between 109 and 112 are used in capture file headers as
- * link-layer types corresponding to DLT_ types that might differ
+ * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's
+ * DLT_SLIP_BSDOS in NetBSD, so we can't use 13 for it in capture-file
+ * headers.
+ */
+#define DLT_ENC                109
+
+/*
+ * Values between 110 and 112 are reserved for use in capture file headers
+ * as link-layer types corresponding to DLT_ types that might differ
  * between platforms; don't use those values for new DLT_ types
  * other than the corresponding DLT_ types.
  */
index f1bb3039a39825d69eb56b9049c629742c24dc32..b759130b77d4e41bd659df2308fadd43ca50b070 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.76 2003-02-11 17:03:22 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.77 2003-03-08 08:42:14 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -156,6 +156,7 @@ static const char rcsid[] =
 #define LINKTYPE_ATM_CLIP      106             /* Linux Classical IP over ATM */
 #define LINKTYPE_FRELAY                107             /* Frame Relay */
 #define LINKTYPE_LOOP          108             /* OpenBSD loopback */
+#define LINKTYPE_ENC           109             /* OpenBSD IPSEC enc */
 
 #define LINKTYPE_LINUX_SLL     113             /* Linux cooked socket capture */
 #define LINKTYPE_LTALK         114             /* Apple LocalTalk hardware */
@@ -173,7 +174,7 @@ static const char rcsid[] =
 
 #define LINKTYPE_ARCNET_LINUX  129             /* Linux-style headers */
 
-#define LINKTYPE_JUNIPER_MLPPP  130            /* Juniper-internal chassis encapsulation */
+#define LINKTYPE_JUNIPER_MLPPP  130            /* Juniper-internal chassis encapsulation */
 #define LINKTYPE_JUNIPER_MLFR   131
 #define LINKTYPE_JUNIPER_ES     132
 #define LINKTYPE_JUNIPER_GGSN   133
@@ -184,7 +185,6 @@ static const char rcsid[] =
 /*
  * These types are reserved for future use.
  */
-#define LINKTYPE_ENC           109             /* OpenBSD IPSEC enc */
 #define LINKTYPE_LANE8023      110             /* ATM LANE + 802.3 */
 #define LINKTYPE_HIPPI         111             /* NetBSD HIPPI */
 #define LINKTYPE_HDLC          112             /* NetBSD HDLC framing */