diff -ur mtr-0.80/ChangeLog mtr-0.80-mpls2/ChangeLog
--- mtr-0.80/ChangeLog	2008-08-19 12:55:47.000000000 -0400
+++ mtr-0.80-mpls2/ChangeLog	2011-03-27 17:43:16.000000000 -0400
@@ -1,3 +1,8 @@
+2011-03-27  Mark Kamichoff <prox@prolixium.com>
+	* Enable decoding of ICMP extensions for MPLS
+	  (only for curses and report interfaces, and only for IPv4, as I
+       know of nothing that implements this for IPv6)
+
 2002-03-06  Cougar <cougar@random.ee>
 	+ If hop doesn't respond, draw its name in red (GTK) or bold (curses)
 
diff -ur mtr-0.80/curses.c mtr-0.80-mpls2/curses.c
--- mtr-0.80/curses.c	2008-10-10 14:51:25.000000000 -0400
+++ mtr-0.80-mpls2/curses.c	2011-03-27 15:49:20.000000000 -0400
@@ -288,11 +288,12 @@
 {
   int max;
   int at;
+  struct mplslen *mpls, *mplss;
   ip_t *addr, *addrs;
   int y, x;
   char *name;
 
-  int i, j;
+  int i, j, k;
   int hd_len;
   char buf[1024];
 
@@ -301,6 +302,7 @@
   for(at = net_min () + display_offset; at < max; at++) {
     printw("%2d. ", at + 1);
     addr = net_addr(at);
+    mpls = net_mpls(at);
 
     if( addrcmp( (void *) addr, (void *) &unspec_addr, af ) != 0 ) {
       name = dns_lookup(addr);
@@ -339,9 +341,20 @@
       buf[hd_len] = 0;
       printw("%s", buf);
 
+      for (k=0; k < mpls->labels; k++) {
+        if((k+1 < mpls->labels) || (mpls->labels == 1)) {
+           /* if we have more labels */
+           printw("     [MPLS: Lbl %lu Exp %u S %u TTL %u]", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]);
+        } else {
+           /* bottom label */
+           printw("\n    [MPLS: Lbl %lu Exp %u S %u TTL %u]", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]);
+        }
+      }
+
       /* Multi path by Min */
       for (i=0; i < MAXPATH; i++ ) {
         addrs = net_addrs(at, i);
+        mplss = net_mplss(at, i);
 	if ( addrcmp( (void *) addrs, (void *) addr, af ) == 0 ) continue;
 	if ( addrcmp( (void *) addrs, (void *) &unspec_addr, af ) == 0 ) break;
 
@@ -352,6 +365,9 @@
         } else {
 	  printw("\n    %s", strlongip( addrs ) );
         }
+        for (k=0; k < mplss->labels; k++) {
+          printw("\n    [MPLS: Lbl %lu Exp %u S %u TTL %u]", mplss->label[k], mplss->exp[k], mplss->s[k], mplss->ttl[k]);
+        }
         attroff(A_BOLD);
       }
 
diff -ur mtr-0.80/net.c mtr-0.80-mpls2/net.c
--- mtr-0.80/net.c	2010-07-13 02:10:33.000000000 -0400
+++ mtr-0.80-mpls2/net.c	2011-03-27 17:39:41.000000000 -0400
@@ -122,6 +122,8 @@
   int transit;
   int saved[SAVED_PINGS];
   int saved_seq_offset;
+  struct mplslen mpls;
+  struct mplslen mplss[MAXPATH];
 };
 
 
@@ -434,7 +436,7 @@
 
 /*   We got a return on something we sent out.  Record the address and
      time.  */
-void net_process_ping(int seq, void * addr, struct timeval now) 
+void net_process_ping(int seq, struct mplslen mpls, void * addr, struct timeval now) 
 {
   int index;
   int totusec;
@@ -467,10 +469,12 @@
 		(void *) &unspec_addr, af ) == 0 ) {
     /* should be out of if as addr can change */
     addrcpy( (void *) &(host[index].addr), addrcopy, af );
+    host[index].mpls = mpls;
     display_rawhost(index, (void *) &(host[index].addr));
 
   /* multi paths by Min */
     addrcpy( (void *) &(host[index].addrs[0]), addrcopy, af );
+    host[index].mplss[0] = mpls;
   } else {
     for( i=0; i<MAXPATH; ) {
       if( addrcmp( (void *) &(host[index].addrs[i]), (void *) &addrcopy,
@@ -482,6 +486,7 @@
     if( addrcmp( (void *) &(host[index].addrs[i]), addrcopy, af ) != 0 && 
         i<MAXPATH ) {
       addrcpy( (void *) &(host[index].addrs[i]), addrcopy, af );
+      host[index].mplss[i] = mpls;
       
       /* rafaelmartins: multi path support to '--raw' */
       display_rawhost(index, (void *) &(host[index].addrs[i]));
@@ -565,6 +570,10 @@
   int echoreplytype = 0, timeexceededtype = 0, unreachabletype = 0;
   int sequence = 0;
 
+  /* MPLS decoding */
+  struct mplslen mpls;
+  mpls.labels = 0;
+
   gettimeofday(&now, NULL);
   switch ( af ) {
   case AF_INET:
@@ -623,6 +632,10 @@
         header = (struct ICMPHeader *)(packet + sizeof (struct IPHeader) + 
                                                 sizeof (struct ICMPHeader) + 
                                                 sizeof (struct IPHeader));
+
+        if(num > 160)
+          decodempls(num, packet, &mpls, 0);
+
       break;
 #ifdef ENABLE_IPV6
       case AF_INET6:
@@ -656,6 +669,10 @@
         udpheader = (struct UDPHeader *)(packet + sizeof (struct IPHeader) +
                                                   sizeof (struct ICMPHeader) +
                                                   sizeof (struct IPHeader));
+
+        if(num > 160)
+          decodempls(num, packet, &mpls, 0);
+
       break;
 #ifdef ENABLE_IPV6
       case AF_INET6:
@@ -674,7 +691,7 @@
   }
 
   if (sequence)
-    net_process_ping(sequence, (void *)fromaddress, now);
+    net_process_ping (sequence, mpls, (void *) fromaddress, now);
 }
 
 
@@ -689,6 +706,15 @@
   return (ip_t *)&(host[at].addrs[i]);
 }
 
+void *net_mpls(int at)
+{
+  return (struct mplslen *)&(host[at].mplss);
+}
+
+void *net_mplss(int at, int i)
+{
+  return (struct mplslen *)&(host[at].mplss[i]);
+}
 
 int net_loss(int at) 
 {
@@ -1261,3 +1287,42 @@
 #endif
   }
 }
+
+/* Decode MPLS */
+void decodempls(int num, char *packet, struct mplslen *mpls, int offset) {
+
+  int i;
+  unsigned int ext_ver, ext_res, ext_chk, obj_hdr_len;
+  u_char obj_hdr_class, obj_hdr_type;
+
+  /* loosely derived from the traceroute-nanog.c
+   * decoding by Jorge Boncompte */
+  ext_ver = packet[156]>>4;
+  ext_res = (packet[156]&15)+ packet[157];
+  ext_chk = ((unsigned int)packet[158]<<8)+packet[159];
+
+  /* Check for ICMP extension header */
+  if (ext_ver == 2 && ext_res == 0 && ext_chk != 0 && num >= 162) {
+    obj_hdr_len = ((int)packet[160]<<8)+packet[161];
+    obj_hdr_class = packet[162];
+    obj_hdr_type = packet[163];
+
+    /* make sure we have an MPLS extension */
+    if (obj_hdr_len >= 8 && obj_hdr_class == 1 && obj_hdr_type == 1) {
+      /* how many labels do we have?  will be at least 1 */
+      mpls->labels = (obj_hdr_len-4)/4;
+
+      /* save all label objects */
+      for(i=0; (i<mpls->labels) && (i < MAXLABELS) && (num >= 164+(i*4)); i++) {
+
+        /* piece together the 20 byte label value */
+        mpls->label[i] = ((unsigned long) (packet[164+(i*4)] << 12 & 0xff000) +
+            (unsigned int) (packet[165+(i*4)] << 4 & 0xff0) +
+            (packet[166+(i*4)] >> 4 & 0xf));
+        mpls->exp[i] = (packet[166+(i*4)] >> 1) & 0x7;
+        mpls->s[i] = (packet[166+(i*4)] & 0x1); /* should be 1 if only one label */
+        mpls->ttl[i] = packet[167+(i*4)];
+      }
+    }
+  }
+}
diff -ur mtr-0.80/net.h mtr-0.80-mpls2/net.h
--- mtr-0.80/net.h	2008-10-10 14:50:04.000000000 -0400
+++ mtr-0.80-mpls2/net.h	2011-03-27 17:35:19.000000000 -0400
@@ -40,6 +40,8 @@
 int net_min(void);
 int net_last(int at);
 ip_t * net_addr(int at);
+void * net_mpls(int at);
+void * net_mplss(int, int);
 int net_loss(int at);
 int net_drop(int at);
 int net_last(int at);
@@ -86,6 +88,7 @@
 
 #define MAXPACKET 4470		/* largest test packet size */
 #define MINPACKET 28		/* 20 bytes IP header and 8 bytes ICMP or UDP */
+#define MAXLABELS 8 		/* http://kb.juniper.net/KB2190 (+ 3 just in case) */
 
 /* stuff used by display such as report, curses... --Min */
 #define MAXFLD 20		/* max stats fields to display */
@@ -119,3 +122,14 @@
 extern char available_options[];
 
 ip_t unspec_addr;
+
+/* MPLS label object */
+struct mplslen {
+  unsigned long label[MAXLABELS]; /* label value */
+  uint8 exp[MAXLABELS]; /* experimental bits */
+  uint8 ttl[MAXLABELS]; /* MPLS TTL */
+  char s[MAXLABELS]; /* bottom of stack */
+  char labels; /* how many labels did we get? */
+};
+
+void decodempls(int, char *, struct mplslen *, int);
diff -ur mtr-0.80/report.c mtr-0.80-mpls2/report.c
--- mtr-0.80/report.c	2010-05-31 11:53:21.000000000 -0400
+++ mtr-0.80-mpls2/report.c	2011-03-27 15:27:31.000000000 -0400
@@ -52,7 +52,8 @@
 
 void report_close(void) 
 {
-  int i, j, at, max, z, w;
+  int i, j, k, at, max, z, w;
+  struct mplslen *mpls, *mplss;
   ip_t *addr;
   ip_t *addr2 = NULL;  
   char name[81];
@@ -102,6 +103,7 @@
   at  = net_min();
   for(; at < max; at++) {
     addr = net_addr(at);
+    mpls = net_mpls(at);
     if( addrcmp( (void *) addr, (void *) &unspec_addr, af ) == 0 ) {
       sprintf(name, "???");
     } else {
@@ -138,24 +140,47 @@
      * This feature show 'loadbalances' on routes 
      */
     
-   /* z is starting at 1 because addrs[0] is the same that addr */
+    /* z is starting at 1 because addrs[0] is the same that addr */
     for (z = 1; z < MAXPATH ; z++) {
-       addr2 = net_addrs(at, z);
-       int found = 0;
-       if ((addrcmp ((void *) &unspec_addr, (void *) addr2, af)) == 0)
-          break;
+      addr2 = net_addrs(at, z);
+      mplss = net_mplss(at, z);
+      int found = 0;
+      if ((addrcmp ((void *) &unspec_addr, (void *) addr2, af)) == 0)
+        break;
       for (w = 0; w < z; w++)
         /* Thales -- Ok... checking if there are ips repeated on same hop */
-           if ((addrcmp ((void *) addr2, (void *) net_addrs (at,w), af)) == 0) {
-              found = 1;
-              break;
-           }   
-       if (!found) {
-        if (z == 1)  
+        if ((addrcmp ((void *) addr2, (void *) net_addrs (at,w), af)) == 0) {
+           found = 1;
+           break;
+        }   
+
+      if (!found) {
+
+        if (mpls->labels && z == 1) {
+          for (k=0; k < mpls->labels; k++) {
+            printf("    |  |+-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]);
+          }
+        }
+
+        if (z == 1) {
           printf ("    |  `|-- %s\n", strlongip(addr2));
-        else 
+          for (k=0; k < mplss->labels; k++) {
+            printf("    |   +-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mplss->label[k], mplss->exp[k], mplss->s[k], mplss->ttl[k]);
+          }
+        } else {
           printf ("    |   |-- %s\n", strlongip(addr2));
-       }
+          for (k=0; k < mplss->labels; k++) {
+            printf("    |   +-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mplss->label[k], mplss->exp[k], mplss->s[k], mplss->ttl[k]);
+          }
+        }
+      }
+    }
+
+    /* No multipath */
+    if(mpls->labels && z == 1) {
+      for (k=0; k < mpls->labels; k++) {
+        printf("    |   +-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]);
+      }
     }
   }
 }
diff -ur mtr-0.80/TODO mtr-0.80-mpls2/TODO
--- mtr-0.80/TODO	2008-09-08 16:00:38.000000000 -0400
+++ mtr-0.80-mpls2/TODO	2011-03-27 17:42:32.000000000 -0400
@@ -98,7 +98,7 @@
   - If we run a mtr to monitor a connection it would be nice if the time at
     which mtr was started is print somewhere. -- Sebastian Ganschow
 
-
+  - Add decoding of ICMP*v6* extensions for MPLS. -- Mark Kamichoff
 
 ------------------------------------------------------------------------
 
