]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Juniper routers do not deliver a heading HEC byte for oam cells: make the OAM printer...
authorhannes <hannes>
Mon, 20 Jun 2005 07:37:01 +0000 (07:37 +0000)
committerhannes <hannes>
Mon, 20 Jun 2005 07:37:01 +0000 (07:37 +0000)
atm.h
interface.h
print-atm.c
print-juniper.c

diff --git a/atm.h b/atm.h
index a4611c0f24e1fd6b448ee4d4d23dd10b57546791..7d7db1923ca0dda88de18ea202214a23ee09f349 100644 (file)
--- a/atm.h
+++ b/atm.h
@@ -14,7 +14,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/atm.h,v 1.1 2002-07-11 09:17:22 guy Exp $
+ * @(#) $Header: /tcpdump/master/tcpdump/atm.h,v 1.2 2005-06-20 07:37:01 hannes Exp $
  */
 
 /*
 #define ATM_UNKNOWN    0       /* Unknown */
 #define ATM_LANE       1       /* LANE */
 #define ATM_LLC                2       /* LLC encapsulation */
+
+/*
+ * some OAM cell captures (most notably Juniper's)
+ * do not deliver a heading HEC byte
+ */
+#define ATM_OAM_NOHEC   0
+#define ATM_OAM_HEC     1
index 28635353a8291a605ef7fbbf73e74517ae936320..f30aeaf044dd33e29a3099563381e6920b6c8e97 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/interface.h,v 1.254 2005-05-27 14:52:35 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.255 2005-06-20 07:39:21 hannes Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -181,7 +181,7 @@ extern void atalk_print(const u_char *, u_int);
 extern void atm_print(u_int, u_int, u_int, const u_char *, u_int, u_int);
 extern u_int atm_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int sunatm_if_print(const struct pcap_pkthdr *, const u_char *);
-extern int oam_print(const u_char *, u_int);
+extern int oam_print(const u_char *, u_int, u_int);
 extern void bootp_print(const u_char *, u_int);
 extern void bgp_print(const u_char *, int);
 extern void beep_print(const u_char *, u_int);
index 110d3881f16015d3c2c4434634247555896687ee..919d5e07f6bbdd41897a3b43c55cb49a167931c4 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.39 2005-05-18 20:24:04 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.40 2005-06-20 07:37:02 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -257,7 +257,7 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
 
                case OAMF4SC: /* fall through */
                case OAMF4EC:
-                        oam_print(p, length);
+                        oam_print(p, length, ATM_OAM_HEC);
                        return;
 
                case METAC:
@@ -288,13 +288,13 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
 }
 
 int 
-oam_print (const u_char *p, u_int length) {
+oam_print (const u_char *p, u_int length, u_int hec) {
 
     u_int16_t cell_header, cell_type, func_type,vpi,vci,payload,clp;
 
     cell_header = EXTRACT_32BITS(p);
-    cell_type = ((*(p+4))>>4) & 0x0f;
-    func_type = *(p+4) & 0x0f;
+    cell_type = ((*(p+4+hec))>>4) & 0x0f;
+    func_type = *(p+4+hec) & 0x0f;
 
     vpi = (cell_header>>20)&0xff;
     vci = (cell_header>>4)&0xffff;
index 5a25f35afdd30b8f0fa11307d49f52c4073dc659..1be8ef86b45f9077ebedc11cade0bc9e9f642a62 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.20 2005-06-09 07:56:26 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.21 2005-06-20 07:37:02 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -34,6 +34,7 @@ static const char rcsid[] _U_ =
 #include "llc.h"
 #include "nlpid.h"
 #include "ethertype.h"
+#include "atm.h"
 
 #define JUNIPER_BPF_OUT           0       /* Outgoing packet */
 #define JUNIPER_BPF_IN            1       /* Incoming packet */
@@ -521,7 +522,7 @@ juniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p)
         p+=l2info.header_len;
 
         if (l2info.cookie[0] == 0x80) { /* OAM cell ? */
-            oam_print(p,l2info.length);
+            oam_print(p,l2info.length,ATM_OAM_NOHEC);
             return l2info.header_len;
         }
 
@@ -576,7 +577,7 @@ juniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p)
                 l2info.length -= 4;
                 p += 4;
             }
-            oam_print(p,l2info.length);
+            oam_print(p,l2info.length,ATM_OAM_NOHEC);
             return l2info.header_len;
         }