]> The Tcpdump Group git mirrors - libpcap/commitdiff
When we add the length of the QoS field to the offset of the MAC
authorguy <guy>
Tue, 6 Nov 2007 19:09:31 +0000 (19:09 +0000)
committerguy <guy>
Tue, 6 Nov 2007 19:09:31 +0000 (19:09 +0000)
payload, the existing value of that offset is *not* in the X register -
the offset of the MAC header is in the X register.  Load the register
containing the offset of the MAC payload, add 2 to it, and store the
result back in that register.

gencode.c

index 69d2ea193ee068e8c2a5d0a4115d3d85ead4b092..9842a5848e4776bfd9b048d217857c9ac11c5905 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -21,7 +21,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.290.2.7 2007-11-05 23:03:35 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.290.2.8 2007-11-06 19:09:31 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -2360,15 +2360,15 @@ gen_load_802_11_header_len(struct slist *s, struct slist *snext)
                
        /*
         * If it's set, add 2 to reg_off_macpl, to skip the QoS
-        * field (the current value of reg_off_macpl is in the
-        * X register, so store 2 + X in reg_off_macpl).
+        * field.
         * Otherwise, go to the first statement of the rest of the
         * program.
         */
-       sjset_qos->s.jt = s2 = new_stmt(BPF_LD|BPF_IMM);
-       s2->s.k = 2;
+       sjset_qos->s.jt = s2 = new_stmt(BPF_LD|BPF_MEM);
+       s2->s.k = reg_off_macpl;
        sappend(s, s2);
-       s2 = new_stmt(BPF_ALU|BPF_ADD|BPF_X);
+       s2 = new_stmt(BPF_ALU|BPF_ADD|BPF_IMM);
+       s2->s.k = 2;
        sappend(s, s2);
        s2 = new_stmt(BPF_ST);
        s2->s.k = reg_off_macpl;