]> The Tcpdump Group git mirrors - tcpdump/blobdiff - sll.h
tcpdump.1 is generated from tcpdump.1.in.
[tcpdump] / sll.h
diff --git a/sll.h b/sll.h
index 84997384c2b02223067d38d83ca6da4cc57c3d64..bad31e27a49fe8e8a740c1e62b62d9d255e8d49f 100644 (file)
--- a/sll.h
+++ b/sll.h
@@ -4,7 +4,7 @@
  *
  * This code is derived from the Stanford/CMU enet packet filter,
  * (net/enet.c) distributed as part of 4.3BSD, and code contributed
- * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
  * Berkeley Laboratory.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/sll.h,v 1.1 2000-12-21 10:43:23 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/sll.h,v 1.7.6.1 2008-05-30 01:38:21 guy Exp $ (LBL)
  */
 
 /*
  *     specified by the previous value.
  *
  * All fields except for the link-layer address are in network byte order.
+ *
+ * DO NOT change the layout of this structure, or change any of the
+ * LINUX_SLL_ values below.  If you must change the link-layer header
+ * for a "cooked" Linux capture, introduce a new DLT_ type (ask
+ * "[email protected]" for one, so that you don't give it
+ * a value that collides with a value already being used), and use the
+ * new header in captures of that type, so that programs that can
+ * handle DLT_LINUX_SLL captures will continue to handle them correctly
+ * without any change, and so that capture files with different headers
+ * can be told apart and programs that read them can dissect the
+ * packets in them.
+ *
+ * This structure, and the #defines below, must be the same in the
+ * libpcap and tcpdump versions of "sll.h".
  */
 
 /*
 
 struct sll_header {
        u_int16_t       sll_pkttype;    /* packet type */
-       u_int16_t       sll_protocol;   /* protocol */
        u_int16_t       sll_hatype;     /* link-layer address type */
        u_int16_t       sll_halen;      /* link-layer address length */
        u_int8_t        sll_addr[SLL_ADDRLEN];  /* link-layer address */
+       u_int16_t       sll_protocol;   /* protocol */
 };
 
 /*
- * The LINUX_SLL_ values; they are defined here so that they're available
- * even on systems other than Linux, but they should be given the same
- * values as the corresponding PACKET_ values on Linux.  (Let's hope
- * those values never change.)
+ * The LINUX_SLL_ values for "sll_pkttype"; these correspond to the
+ * PACKET_ values on Linux, but are defined here so that they're
+ * available even on systems other than Linux, and so that they
+ * don't change even if the PACKET_ values change.
  */
 #define LINUX_SLL_HOST         0
 #define LINUX_SLL_BROADCAST    1
 #define LINUX_SLL_MULTICAST    2
 #define LINUX_SLL_OTHERHOST    3
 #define LINUX_SLL_OUTGOING     4
+
+/*
+ * The LINUX_SLL_ values for "sll_protocol"; these correspond to the
+ * ETH_P_ values on Linux, but are defined here so that they're
+ * available even on systems other than Linux.  We assume, for now,
+ * that the ETH_P_ values won't change in Linux; if they do, then:
+ *
+ *     if we don't translate them in "pcap-linux.c", capture files
+ *     won't necessarily be readable if captured on a system that
+ *     defines ETH_P_ values that don't match these values;
+ *
+ *     if we do translate them in "pcap-linux.c", that makes life
+ *     unpleasant for the BPF code generator, as the values you test
+ *     for in the kernel aren't the values that you test for when
+ *     reading a capture file, so the fixup code run on BPF programs
+ *     handed to the kernel ends up having to do more work.
+ *
+ * Add other values here as necessary, for handling packet types that
+ * might show up on non-Ethernet, non-802.x networks.  (Not all the ones
+ * in the Linux "if_ether.h" will, I suspect, actually show up in
+ * captures.)
+ */
+#define LINUX_SLL_P_802_3      0x0001  /* Novell 802.3 frames without 802.2 LLC header */
+#define LINUX_SLL_P_802_2      0x0004  /* 802.2 frames (not D/I/X Ethernet) */