summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannes <hannes>2005-06-20 07:37:01 +0000
committerhannes <hannes>2005-06-20 07:37:01 +0000
commit99b69f68980a6f0f71a1d8f81e35d40ed028cd13 (patch)
treece696c284baa57afe81eaf14c6445a5bcd33caec
parentd16e94e8487d7025d213595c47fc81f6a6c70b40 (diff)
downloadtcpdump-99b69f68980a6f0f71a1d8f81e35d40ed028cd13.tar.gz
Juniper routers do not deliver a heading HEC byte for oam cells: make the OAM printer to support both HEC and non-HEC OAM cells
-rw-r--r--atm.h9
-rw-r--r--interface.h4
-rw-r--r--print-atm.c10
-rw-r--r--print-juniper.c7
4 files changed, 19 insertions, 11 deletions
diff --git a/atm.h b/atm.h
index a4611c0f..7d7db192 100644
--- 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 $
*/
/*
@@ -23,3 +23,10 @@
#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
diff --git a/interface.h b/interface.h
index 28635353..f30aeaf0 100644
--- a/interface.h
+++ b/interface.h
@@ -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);
diff --git a/print-atm.c b/print-atm.c
index 110d3881..919d5e07 100644
--- a/print-atm.c
+++ b/print-atm.c
@@ -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;
diff --git a/print-juniper.c b/print-juniper.c
index 5a25f35a..1be8ef86 100644
--- a/print-juniper.c
+++ b/print-juniper.c
@@ -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;
}