add support for cisco-style ethertype encaps within frame-relay

This commit is contained in:
hannes 2004-10-07 16:04:06 +00:00
parent 4d399db499
commit de7827fb7e
2 changed files with 27 additions and 4 deletions

View File

@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.23 2004-06-12 16:32:56 hannes Exp $ (LBL)
* @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.24 2004-10-07 16:04:07 hannes Exp $ (LBL)
*/
/*
@ -33,6 +33,10 @@
* <netinet/if_ether.h> if all it needs are ETHERTYPE_ values.
*/
#ifndef ETHERTYPE_LEN
#define ETHERTYPE_LEN 2
#endif
#ifndef ETHERTYPE_GRE_ISO
#define ETHERTYPE_GRE_ISO 0x00FE /* not really an ethertype only used in GRE */
#endif

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
"@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.22 2004-10-07 14:53:10 hannes Exp $ (LBL)";
"@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.23 2004-10-07 16:04:06 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -176,8 +176,27 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
return caplen;
}
if (p[addr_len] != 0x03)
printf("UI %02x! ", p[addr_len]);
if (p[addr_len] != 0x03) {
/* lets figure out if we have cisco style encapsulation: */
extracted_ethertype = EXTRACT_16BITS(p+addr_len);
if (eflag)
printf("%s (0x%04x), length %u: ",
tok2str(ethertype_values, "unknown", extracted_ethertype),
extracted_ethertype,
length);
if (ether_encap_print(extracted_ethertype,
p+addr_len+ETHERTYPE_LEN,
length-(addr_len),
caplen-(addr_len),
&extracted_ethertype) == 0)
/* ether_type not known, probably it wasn't one */
printf("UI %02x! ", p[addr_len]);
else
return hdr_len;
}
if (!p[addr_len + 1]) { /* pad byte should be used with 3-byte Q.922 */
if (addr_len != 3)