diff options
Diffstat (limited to 'contrib/tcpdump/print-atm.c')
-rw-r--r-- | contrib/tcpdump/print-atm.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/contrib/tcpdump/print-atm.c b/contrib/tcpdump/print-atm.c index ced9c46..95f24b2 100644 --- a/contrib/tcpdump/print-atm.c +++ b/contrib/tcpdump/print-atm.c @@ -17,10 +17,12 @@ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $FreeBSD$ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.21 2001/07/05 18:54:14 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.20 2000/12/22 22:45:09 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -51,16 +53,26 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) { u_int caplen = h->caplen; u_int length = h->len; - u_short ethertype; + u_short ethertype, extracted_ethertype; - ++infodelay; ts_print(&h->ts); if (caplen < 8) { printf("[|atm]"); goto out; } - if (p[0] != 0xaa || p[1] != 0xaa || p[2] != 0x03) { + + if (p[4] == 0xaa || p[5] == 0xaa || p[6] == 0x03) { + /* if first 4 bytes are cookie/vpci */ + if (eflag) { + printf("%04x ", + p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]); + } + p += 4; + length -= 4; + caplen -= 4; + } + else if (p[0] != 0xaa || p[1] != 0xaa || p[2] != 0x03) { /*XXX assume 802.6 MAC header from fore driver */ if (eflag) printf("%04x%04x %04x%04x ", @@ -129,20 +141,20 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) /* default_print for now */ #endif default: - /* ether_type not known, print raw packet */ + /* ether_type not known, forward it to llc_print */ if (!eflag) printf("%02x %02x %02x %02x-%02x-%02x %04x: ", packetp[0], packetp[1], packetp[2], /* dsap/ssap/ctrl */ packetp[3], packetp[4], packetp[5], /* manufacturer's code */ ethertype); - if (!xflag && !qflag) - default_print(p, caplen); + if (!xflag && !qflag) { + extracted_ethertype = 0; + /* default_print(p, caplen); */ + llc_print(p-8,length+8,caplen+8,"000000","000000", &extracted_ethertype); + } } if (xflag) default_print(p, caplen); out: putchar('\n'); - --infodelay; - if (infoprint) - info(0); } |