mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-24 02:23:27 +08:00
add support for Juniper ML-PPP DLT for printing captures
taken on the Link-Service (LS) and Multi-Link (ML) PICs
This commit is contained in:
parent
b00adae2bc
commit
3e2b7a0477
@ -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.241 2005-01-27 10:13:51 hannes Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.242 2005-01-27 18:30:37 hannes Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_interface_h
|
||||
@ -249,6 +249,7 @@ extern u_int chdlc_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_atm1_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_atm2_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_mlfr_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_mlppp_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern void snmp_print(const u_char *, u_int);
|
||||
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.6 2005-01-27 10:17:58 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.7 2005-01-27 18:30:36 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -49,6 +49,59 @@ int ip_heuristic_guess(register const u_char *, u_int);
|
||||
int juniper_ppp_heuristic_guess(register const u_char *, u_int);
|
||||
static int juniper_parse_header (const u_char *, u_int8_t *, u_int);
|
||||
|
||||
u_int
|
||||
juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
u_int8_t direction,bundle,cookie_len;
|
||||
u_int32_t cookie,proto;
|
||||
|
||||
if(juniper_parse_header(p, &direction,length) == 0)
|
||||
return 0;
|
||||
|
||||
p+=4;
|
||||
length-=4;
|
||||
caplen-=4;
|
||||
|
||||
if (p[0] == LS_COOKIE_ID) {
|
||||
cookie=EXTRACT_32BITS(p);
|
||||
if (eflag) printf("LSPIC-MLPPP cookie 0x%08x, ",cookie);
|
||||
cookie_len = LS_MLFR_LEN;
|
||||
bundle = cookie & 0xff;
|
||||
} else {
|
||||
cookie=EXTRACT_16BITS(p);
|
||||
if (eflag) printf("MLPIC-MLPPP cookie 0x%04x, ",cookie);
|
||||
cookie_len = ML_MLFR_LEN;
|
||||
bundle = (cookie >> 8) & 0xff;
|
||||
}
|
||||
|
||||
proto = EXTRACT_16BITS(p+cookie_len);
|
||||
p += cookie_len;
|
||||
length-= cookie_len;
|
||||
caplen-= cookie_len;
|
||||
|
||||
/* suppress Bundle-ID if frame was captured on a child-link
|
||||
* this may be the case if the cookie looks like a proto */
|
||||
if (eflag &&
|
||||
cookie != PPP_OSI &&
|
||||
cookie != (PPP_ADDRESS << 8 | PPP_CONTROL))
|
||||
printf("Bundle-ID %u, ",bundle);
|
||||
|
||||
switch (cookie) {
|
||||
case PPP_OSI:
|
||||
ppp_print(p-2,length+2);
|
||||
break;
|
||||
case (PPP_ADDRESS << 8 | PPP_CONTROL): /* fall through */
|
||||
default:
|
||||
ppp_print(p,length);
|
||||
break;
|
||||
}
|
||||
|
||||
return cookie_len;
|
||||
}
|
||||
|
||||
|
||||
u_int
|
||||
juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ static const char copyright[] _U_ =
|
||||
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.252 2005-01-27 10:17:59 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.253 2005-01-27 18:30:36 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -228,6 +228,9 @@ static struct printer printers[] = {
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MLFR
|
||||
{ juniper_mlfr_print, DLT_JUNIPER_MLFR },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MLPPP
|
||||
{ juniper_mlppp_print, DLT_JUNIPER_MLPPP },
|
||||
#endif
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user