dect
/
libpcap
Archived
13
0
Fork 0

bugreport from Paolo Lucente <paolo.lucente@ic.cnr.it>:

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
This commit is contained in:
hannes 2005-06-06 14:14:01 +00:00
parent 6205efb7ab
commit 8b719a55ac
1 changed files with 1 additions and 3 deletions

View File

@ -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;