]> The Tcpdump Group git mirrors - libpcap/commitdiff
bugreport from Paolo Lucente <[email protected]>:
authorhannes <hannes>
Mon, 6 Jun 2005 14:14:01 +0000 (14:14 +0000)
committerhannes <hannes>
Mon, 6 Jun 2005 14:14:01 +0000 (14:14 +0000)
the mpls stack processing is broken:
for example "mpls 10000 && mpls 20000" does produce

reading from file ppp.pcap, link-type PPP (PPP)
(000) ldh      [2]
(001) jeq      #0x00000281      jt 2    jf 11
(002) ld       [4]
(003) and      #0xfffff000
(004) jeq      #0x02710000      jt 5    jf 11
(005) ldh      [6]
(006) jeq      #0x00000281      jt 7    jf 11
(007) ld       [8]
(008) and      #0xfffff000
(009) jeq      #0x04e20000      jt 10   jf 11
(010) ret      #1514
(011) ret      #0

the extra match for 0x281 at instruction #6 is broken and
a copy&paste artifact from the vlan code generator, which
in contrast does require the VLAN tag 0x8100 at every instance
inside a VLAN stack;

correct code should be:

(000) ldh      [2]
(001) jeq      #0x281           jt 2    jf 9
(002) ld       [4]
(003) and      #0xfffff000
(004) jeq      #0x2710000       jt 5    jf 9
(005) ld       [8]
(006) and      #0xfffff000
(007) jeq      #0x4e20000       jt 8    jf 9
(008) ret      #1514
(009) ret      #0

gencode.c

index 37246e46e46611b50f0f74cc3030681bbf348ee9..c5842aa5c1e876d2ede34cedc8910c0efd9fef8a 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.221.2.21 2005-05-28 00:30:21 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.22 2005-06-06 14:14:01 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -6242,7 +6242,6 @@ gen_mpls(label_num)
             
         case DLT_C_HDLC: /* fall through */
         case DLT_EN10MB:
-                off_linktype += 4;
                 off_nl_nosnap += 4;
                 off_nl += 4;
                         
@@ -6251,7 +6250,6 @@ gen_mpls(label_num)
                 break;
 
         case DLT_PPP:
-                off_linktype += 4;
                 off_nl_nosnap += 4;
                 off_nl += 4;