#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8.2.5 2005-05-10 10:47:47 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8.2.6 2005-05-12 07:23:07 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "ppp.h"
#include "llc.h"
#include "nlpid.h"
+#include "ethertype.h"
#define JUNIPER_BPF_OUT 0 /* Outgoing packet */
#define JUNIPER_BPF_IN 1 /* Incoming packet */
{ 0, NULL}
};
-/* FIXME change enums to real DLT_s */
-enum {
- JUNIPER_ATM1,
- JUNIPER_ATM2,
- JUNIPER_MLPPP,
- JUNIPER_MLFR,
- JUNIPER_MFR,
- JUNIPER_PPPOE
-};
-
enum {
DEFAULT,
LS_COOKIE
};
static struct juniper_cookie_table_t juniper_cookie_table[] = {
- { JUNIPER_ATM1, 4, "ATM1"},
- { JUNIPER_ATM2, 8, "ATM2"},
- { JUNIPER_MLPPP, 2, "MLPPP"},
- { JUNIPER_MLFR, 2, "MLFR"},
- { JUNIPER_MFR, 4, "MFR"},
- { JUNIPER_PPPOE, 0, "PPPoE"},
+ { DLT_JUNIPER_ATM1, 4, "ATM1"},
+ { DLT_JUNIPER_ATM2, 8, "ATM2"},
+ { DLT_JUNIPER_MLPPP, 2, "MLPPP"},
+ { DLT_JUNIPER_MLFR, 2, "MLFR"},
+ { DLT_JUNIPER_MFR, 4, "MFR"},
+ { DLT_JUNIPER_PPPOE, 0, "PPPoE"},
+ { DLT_JUNIPER_PPPOE_ATM, 0, "PPPoE ATM"},
};
struct juniper_l2info_t {
{
struct juniper_l2info_t l2info;
- l2info.pictype = JUNIPER_PPPOE;
+ l2info.pictype = DLT_JUNIPER_PPPOE;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
return l2info.header_len;
}
+u_int
+juniper_pppoe_atm_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+ struct juniper_l2info_t l2info;
+ u_int16_t extracted_ethertype;
+
+ l2info.pictype = DLT_JUNIPER_PPPOE_ATM;
+ if(juniper_parse_header(p, h, &l2info) == 0)
+ return l2info.header_len;
+
+ p+=l2info.header_len;
+
+ extracted_ethertype = EXTRACT_16BITS(p);
+ /* this DLT contains nothing but raw PPPoE frames,
+ * prepended with a type field*/
+ if (ether_encap_print(extracted_ethertype,
+ p+ETHERTYPE_LEN,
+ l2info.length-ETHERTYPE_LEN,
+ l2info.caplen-ETHERTYPE_LEN,
+ &extracted_ethertype) == 0)
+ /* ether_type not known, probably it wasn't one */
+ printf("unknown ethertype 0x%04x", extracted_ethertype);
+
+ return l2info.header_len;
+}
u_int
juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
- l2info.pictype = JUNIPER_MLPPP;
+ l2info.pictype = DLT_JUNIPER_MLPPP;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
{
struct juniper_l2info_t l2info;
- l2info.pictype = JUNIPER_MFR;
+ l2info.pictype = DLT_JUNIPER_MFR;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
{
struct juniper_l2info_t l2info;
- l2info.pictype = JUNIPER_MLFR;
+ l2info.pictype = DLT_JUNIPER_MLFR;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
struct juniper_l2info_t l2info;
- l2info.pictype = JUNIPER_ATM1;
+ l2info.pictype = DLT_JUNIPER_ATM1;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
struct juniper_l2info_t l2info;
- l2info.pictype = JUNIPER_ATM2;
+ l2info.pictype = DLT_JUNIPER_ATM2;
if(juniper_parse_header(p, h, &l2info) == 0)
return l2info.header_len;
/* DLT_ specific parsing */
switch(l2info->pictype) {
- case JUNIPER_MLPPP:
+ case DLT_JUNIPER_MLPPP:
if (l2info->cookie_type == LS_COOKIE) {
l2info->bundle = l2info->cookie[1];
} else {
l2info->bundle = l2info->cookie[0];
}
break;
- case JUNIPER_MLFR: /* fall through */
- case JUNIPER_MFR:
+ case DLT_JUNIPER_MLFR: /* fall through */
+ case DLT_JUNIPER_MFR:
if (l2info->cookie_type == LS_COOKIE) {
l2info->bundle = l2info->cookie[1];
} else {
l2info->length -= 2;
l2info->caplen -= 2;
break;
- case JUNIPER_ATM2:
- case JUNIPER_ATM1:
+ case DLT_JUNIPER_ATM2:
+ case DLT_JUNIPER_ATM1:
default:
break;