X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/f555c163f90c9de17ebcef8313f86404c5174ca9..c23f7b7dcf9c014cf531d75c22cc254c7ca35e55:/print-fddi.c diff --git a/print-fddi.c b/print-fddi.c index ab1585b7..c1e3e208 100644 --- a/print-fddi.c +++ b/print-fddi.c @@ -21,26 +21,20 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.36 1999-10-07 23:47:11 mcr Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.52 2001-09-18 15:46:36 fenner Exp $ (LBL)"; +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" #endif -#ifdef HAVE_FDDI #include #include #include #include #include -#if __STDC__ -struct mbuf; -struct rtentry; -#endif -#include - #include -#include -#include -#include #include #include @@ -52,12 +46,13 @@ struct rtentry; #include "addrtoname.h" #include "ethertype.h" +#include "ether.h" #include "fddi.h" /* * Some FDDI interfaces use bit-swapped addresses. */ -#if defined(ultrix) || defined(__alpha) || defined(__bsdi) +#if defined(ultrix) || defined(__alpha) || defined(__bsdi) || defined(__NetBSD__) int fddi_bitswap = 0; #else int fddi_bitswap = 1; @@ -93,8 +88,6 @@ int fddi_bitswap = 1; * - vj */ -#define FDDI_HDRLEN (sizeof(struct fddi_header)) - static u_char fddi_bit_swap[] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, @@ -217,8 +210,8 @@ extract_fddi_addrs(const struct fddi_header *fddip, char *fsrc, char *fdst) fsrc[i] = fddi_bit_swap[fddip->fddi_shost[i]]; } else { - memcpy(fdst, (char *)fddip->fddi_dhost, 6); - memcpy(fsrc, (char *)fddip->fddi_shost, 6); + memcpy(fdst, (const char *)fddip->fddi_dhost, 6); + memcpy(fsrc, (const char *)fddip->fddi_shost, 6); } } @@ -229,7 +222,7 @@ static inline void fddi_print(register const struct fddi_header *fddip, register u_int length, register const u_char *fsrc, register const u_char *fdst) { - char *srcname, *dstname; + const char *srcname, *dstname; srcname = etheraddr_string(fsrc); dstname = etheraddr_string(fdst); @@ -265,10 +258,11 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h, { u_int caplen = h->caplen; u_int length = h->len; - const struct fddi_header *fddip = (struct fddi_header *)p; - extern u_short extracted_ethertype; + const struct fddi_header *fddip = (const struct fddi_header *)p; struct ether_header ehdr; + u_short extracted_ethertype; + ++infodelay; ts_print(&h->ts); if (caplen < FDDI_HDRLEN) { @@ -286,10 +280,10 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h, */ snapend = p + caplen; /* - * Actually, the only printer that uses packetp is print-bootp.c, - * and it assumes that packetp points to an Ethernet header. The - * right thing to do is to fix print-bootp.c to know which link - * type is in use when it excavates. XXX + * Actually, the only printers that use packetp are print-arp.c + * and print-bootp.c, and they assume that packetp points to an + * Ethernet header. The right thing to do is to fix them to know + * which link type is in use when they excavate. XXX */ packetp = (u_char *)&ehdr; @@ -305,14 +299,14 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h, extracted_ethertype = 0; if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_LLC_ASYNC) { /* Try to print the LLC-layer header & higher layers */ - if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr)) - == 0) { + if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr), + &extracted_ethertype) == 0) { /* * Some kinds of LLC packet we cannot * handle intelligently */ if (!eflag) - fddi_print(fddip, length, + fddi_print(fddip, length + FDDI_HDRLEN, ESRC(&ehdr), EDST(&ehdr)); if (extracted_ethertype) { printf("(LLC %s) ", @@ -326,7 +320,8 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h, else { /* Some kinds of FDDI packet we cannot handle intelligently */ if (!eflag) - fddi_print(fddip, length, ESRC(&ehdr), EDST(&ehdr)); + fddi_print(fddip, length + FDDI_HDRLEN, ESRC(&ehdr), + EDST(&ehdr)); if (!xflag && !qflag) default_print(p, caplen); } @@ -334,20 +329,7 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h, default_print(p, caplen); out: putchar('\n'); + --infodelay; + if (infoprint) + info(0); } -#else -#include -#include - -#include - -#include "interface.h" -void -fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h, - register const u_char *p) -{ - - error("not configured for fddi"); - /* NOTREACHED */ -} -#endif