X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/bd00116d80c18b782f4cb15dfc90cd5bf993d4f5..d7b497cac78b6e22a66a6bae9bdec60a8044f67a:/print-fddi.c?ds=inline diff --git a/print-fddi.c b/print-fddi.c index 7576b6f0..27803783 100644 --- a/print-fddi.c +++ b/print-fddi.c @@ -19,15 +19,17 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +/* \summary: Fiber Distributed Data Interface (FDDI) printer */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include #include -#include "interface.h" +#include "netdissect.h" #include "addrtoname.h" #include "ether.h" @@ -83,9 +85,9 @@ struct fddi_header { * Some FDDI interfaces use bit-swapped addresses. */ #if defined(ultrix) || defined(__alpha) || defined(__bsdi) || defined(__NetBSD__) || defined(__linux__) -int fddi_bitswap = 0; +static int fddi_bitswap = 0; #else -int fddi_bitswap = 1; +static int fddi_bitswap = 1; #endif /* @@ -258,17 +260,11 @@ fddi_hdr_print(netdissect_options *ndo, srcname = etheraddr_string(ndo, fsrc); dstname = etheraddr_string(ndo, fdst); - if (ndo->ndo_vflag) - ND_PRINT((ndo, "%02x %s %s %d: ", - fddip->fddi_fc, - srcname, dstname, - length)); - else if (ndo->ndo_qflag) - ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length)); - else { + if (!ndo->ndo_qflag) print_fddi_fc(ndo, fddip->fddi_fc); - ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length)); - } + ND_PRINT((ndo, "%s > %s, length %u: ", + srcname, dstname, + length)); } static inline void @@ -282,6 +278,7 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) { const struct fddi_header *fddip = (const struct fddi_header *)p; struct ether_header ehdr; + struct lladdr_info src, dst; int llc_hdrlen; if (caplen < FDDI_HDRLEN) { @@ -297,6 +294,11 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) if (ndo->ndo_eflag) fddi_hdr_print(ndo, fddip, length, ESRC(&ehdr), EDST(&ehdr)); + src.addr = ESRC(&ehdr); + src.addr_string = etheraddr_string; + dst.addr = EDST(&ehdr); + dst.addr_string = etheraddr_string; + /* Skip over FDDI MAC header */ length -= FDDI_HDRLEN; p += FDDI_HDRLEN; @@ -305,7 +307,7 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) /* Frame Control field determines interpretation of packet */ if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_LLC_ASYNC) { /* Try to print the LLC-layer header & higher layers */ - llc_hdrlen = llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr)); + llc_hdrlen = llc_print(ndo, p, length, caplen, &src, &dst); if (llc_hdrlen < 0) { /* * Some kinds of LLC packet we cannot