#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8.2.9 2005-05-22 21:25:41 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8.2.13 2005-06-20 07:45:05 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#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 */
};
static struct juniper_cookie_table_t juniper_cookie_table[] = {
+#ifdef DLT_JUNIPER_ATM1
{ DLT_JUNIPER_ATM1, 4, "ATM1"},
+#endif
+#ifdef DLT_JUNIPER_ATM2
{ DLT_JUNIPER_ATM2, 8, "ATM2"},
+#endif
+#ifdef DLT_JUNIPER_MLPPP
{ DLT_JUNIPER_MLPPP, 2, "MLPPP"},
+#endif
+#ifdef DLT_JUNIPER_MLFR
{ DLT_JUNIPER_MLFR, 2, "MLFR"},
+#endif
+#ifdef DLT_JUNIPER_MFR
{ DLT_JUNIPER_MFR, 4, "MFR"},
+#endif
+#ifdef DLT_JUNIPER_PPPOE
{ DLT_JUNIPER_PPPOE, 0, "PPPoE"},
+#endif
+#ifdef DLT_JUNIPER_PPPOE_ATM
{ DLT_JUNIPER_PPPOE_ATM, 0, "PPPoE ATM"},
+#endif
+#ifdef DLT_JUNIPER_GGSN
{ DLT_JUNIPER_GGSN, 8, "GGSN"},
+#endif
+#ifdef DLT_JUNIPER_MONITOR
{ DLT_JUNIPER_MONITOR, 8, "MONITOR"},
+#endif
+#ifdef DLT_JUNIPER_SERVICES
{ DLT_JUNIPER_SERVICES, 8, "AS"},
+#endif
+#ifdef DLT_JUNIPER_ES
{ DLT_JUNIPER_ES, 0, "ES"},
+#endif
+ { 0, 0, NULL }
};
struct juniper_l2info_t {
int juniper_ppp_heuristic_guess(register const u_char *, u_int);
static int juniper_parse_header (const u_char *, const struct pcap_pkthdr *, struct juniper_l2info_t *);
+#ifdef DLT_JUNIPER_GGSN
u_int
juniper_ggsn_print(const struct pcap_pkthdr *h, register const u_char *p)
{
return l2info.header_len;
}
+#endif
+#ifdef DLT_JUNIPER_ES
u_int
juniper_es_print(const struct pcap_pkthdr *h, register const u_char *p)
{
ip_print(gndo, p, l2info.length);
return l2info.header_len;
}
+#endif
+#ifdef DLT_JUNIPER_MONITOR
u_int
juniper_monitor_print(const struct pcap_pkthdr *h, register const u_char *p)
{
return l2info.header_len;
}
+#endif
+#ifdef DLT_JUNIPER_SERVICES
u_int
juniper_services_print(const struct pcap_pkthdr *h, register const u_char *p)
{
return l2info.header_len;
}
+#endif
+#ifdef DLT_JUNIPER_PPPOE
u_int
juniper_pppoe_print(const struct pcap_pkthdr *h, register const u_char *p)
{
ether_print(p, l2info.length, l2info.caplen);
return l2info.header_len;
}
+#endif
+#ifdef DLT_JUNIPER_PPPOE_ATM
u_int
juniper_pppoe_atm_print(const struct pcap_pkthdr *h, register const u_char *p)
{
return l2info.header_len;
}
+#endif
+#ifdef DLT_JUNIPER_MLPPP
u_int
juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
{
case JUNIPER_LSQ_L3_PROTO_IPV4:
ip_print(gndo, p, l2info.length);
return l2info.header_len;
+#ifdef INET6
case JUNIPER_LSQ_L3_PROTO_IPV6:
ip6_print(p,l2info.length);
return l2info.header_len;
+#endif
case JUNIPER_LSQ_L3_PROTO_MPLS:
mpls_print(p,l2info.length);
return l2info.header_len;
return l2info.header_len;
}
+#endif
+#ifdef DLT_JUNIPER_MFR
u_int
juniper_mfr_print(const struct pcap_pkthdr *h, register const u_char *p)
{
return l2info.header_len;
}
+#endif
+#ifdef DLT_JUNIPER_MLFR
u_int
juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
{
return l2info.header_len;
}
+#endif
/*
* ATM1 PIC cookie format
* +-----+-------------------------+-------------------------------+
*/
+#ifdef DLT_JUNIPER_ATM1
u_int
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;
}
return l2info.header_len;
}
+#endif
/*
* ATM2 PIC cookie format
* +-------------------------------+---------+---+-----+-----------+
*/
+#ifdef DLT_JUNIPER_ATM2
u_int
juniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p)
{
u_int16_t extracted_ethertype;
+ u_int32_t control_word;
struct juniper_l2info_t l2info;
p+=l2info.header_len;
if (l2info.cookie[7] & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */
- oam_print(p,l2info.length);
+ control_word = EXTRACT_32BITS(p);
+ if(control_word == 0 || control_word == 0x08000000) {
+ l2info.header_len += 4;
+ l2info.length -= 4;
+ p += 4;
+ }
+ oam_print(p,l2info.length,ATM_OAM_NOHEC);
return l2info.header_len;
}
return l2info.header_len;
}
+#endif
/* try to guess, based on all PPP protos that are supported in