]> The Tcpdump Group git mirrors - libpcap/commitdiff
Add some comments and expand some other comments.
authorGuy Harris <[email protected]>
Fri, 6 Feb 2015 08:08:41 +0000 (00:08 -0800)
committerGuy Harris <[email protected]>
Fri, 6 Feb 2015 08:08:41 +0000 (00:08 -0800)
gencode.c

index d96de870a5c56fa56fabbd50c04b449f851cf3b6..8eb8cd216da9963833adb28deab1d3b49dade0aa 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -827,12 +827,16 @@ static int reg_off_macpl;
 /*
  * "off_linktype" is the offset to information in the link-layer header
  * giving the packet type.  This offset is relative to the beginning
- * of the link-layer header (i.e., it doesn't include off_ll).
+ * of the link-layer header - i.e., it doesn't include off_ll - so
+ * loads with an offset that includes "off_linktype" should use
+ * OR_LINK.
  *
- * For Ethernet, it's the offset of the Ethernet type field.
+ * For Ethernet, it's the offset of the Ethernet type field; this
+ * means that it must have a value that skips VLAN tags.
  *
  * For link-layer types that always use 802.2 headers, it's the
- * offset of the LLC header.
+ * offset of the LLC header; this means that it must have a value
+ * that skips VLAN tags.
  *
  * For PPP, it's the offset of the PPP type field.
  *
@@ -8095,7 +8099,16 @@ gen_vlan_no_bpf_extensions(int vlan_num)
                 b0 = b1;
         }
 
+       /*
+        * The payload follows the full header, including the
+        * VLAN tags, so skip past this VLAN tag.
+        */
         off_macpl += 4;
+
+       /*
+        * The link-layer type information follows the VLAN tags, so
+        * skip past this VLAN tag.
+        */
         off_linktype += 4;
 
         return b0;