]> The Tcpdump Group git mirrors - tcpdump/commitdiff
add support for cisco-style ethertype encaps within frame-relay
authorhannes <hannes>
Thu, 7 Oct 2004 16:04:06 +0000 (16:04 +0000)
committerhannes <hannes>
Thu, 7 Oct 2004 16:04:06 +0000 (16:04 +0000)
ethertype.h
print-fr.c

index f0fc35093cc1f0b032da5a20ae55c382c87b42a3..6e93be9fb5d9e06619818c11545d10e215d2018a 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.23 2004-06-12 16:32:56 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.24 2004-10-07 16:04:07 hannes Exp $ (LBL)
  */
 
 /*
  * <netinet/if_ether.h> if all it needs are ETHERTYPE_ values.
  */
 
+#ifndef ETHERTYPE_LEN
+#define ETHERTYPE_LEN           2
+#endif
+
 #ifndef ETHERTYPE_GRE_ISO
 #define ETHERTYPE_GRE_ISO       0x00FE  /* not really an ethertype only used in GRE */
 #endif
index 9c9aec5705a56ad533c3f6051c11b8d74a09ccdf..e71cb853f172da08657d6e44b33c240156f6ac2c 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.22 2004-10-07 14:53:10 hannes Exp $ (LBL)";
+       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.23 2004-10-07 16:04:06 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -176,8 +176,27 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
                return caplen;
        }
 
-       if (p[addr_len] != 0x03)
-               printf("UI %02x! ", p[addr_len]);
+       if (p[addr_len] != 0x03) {
+
+                /* lets figure out if we have cisco style encapsulation: */
+                extracted_ethertype = EXTRACT_16BITS(p+addr_len);
+
+                if (eflag)
+                    printf("%s (0x%04x), length %u: ",
+                           tok2str(ethertype_values, "unknown", extracted_ethertype),
+                           extracted_ethertype,
+                           length);
+
+                if (ether_encap_print(extracted_ethertype,
+                                      p+addr_len+ETHERTYPE_LEN,
+                                      length-(addr_len),
+                                      caplen-(addr_len),
+                                      &extracted_ethertype) == 0)
+                    /* ether_type not known, probably it wasn't one */
+                    printf("UI %02x! ", p[addr_len]);
+                else
+                    return hdr_len;                    
+        }
 
        if (!p[addr_len + 1]) { /* pad byte should be used with 3-byte Q.922 */
                if (addr_len != 3)