X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/b56aab38621915a192be3fab9334207a12b1cb9a..a7a76012a129ffefb64f102948db63fbc715e45e:/print-atalk.c diff --git a/print-atalk.c b/print-atalk.c index a5ce58a4..cf93b7e8 100644 --- a/print-atalk.c +++ b/print-atalk.c @@ -144,11 +144,11 @@ llap_print(netdissect_options *ndo, return (0); /* cut short by the snapshot length */ } dp = (const struct atDDP *)bp; - snet = EXTRACT_16BITS(&dp->srcNet); + snet = EXTRACT_BE_16BITS(&dp->srcNet); ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode), ddpskt_string(ndo, dp->srcSkt))); ND_PRINT((ndo, " > %s.%s:", - ataddr_string(ndo, EXTRACT_16BITS(&dp->dstNet), dp->dstNode), + ataddr_string(ndo, EXTRACT_BE_16BITS(&dp->dstNet), dp->dstNode), ddpskt_string(ndo, dp->dstSkt))); bp += ddpSize; length -= ddpSize; @@ -194,11 +194,11 @@ atalk_print(netdissect_options *ndo, return; } dp = (const struct atDDP *)bp; - snet = EXTRACT_16BITS(&dp->srcNet); + snet = EXTRACT_BE_16BITS(&dp->srcNet); ND_PRINT((ndo, "%s.%s", ataddr_string(ndo, snet, dp->srcNode), ddpskt_string(ndo, dp->srcSkt))); ND_PRINT((ndo, " > %s.%s: ", - ataddr_string(ndo, EXTRACT_16BITS(&dp->dstNet), dp->dstNode), + ataddr_string(ndo, EXTRACT_BE_16BITS(&dp->dstNet), dp->dstNode), ddpskt_string(ndo, dp->dstSkt))); bp += ddpSize; length -= ddpSize; @@ -221,14 +221,14 @@ aarp_print(netdissect_options *ndo, ND_PRINT((ndo, " [|aarp]")); return; } - if (length < sizeof(*ap)) { + if (length < sizeof(*ap)) { ND_PRINT((ndo, " [|aarp %u]", length)); return; } - if (EXTRACT_16BITS(&ap->htype) == 1 && - EXTRACT_16BITS(&ap->ptype) == ETHERTYPE_ATALK && + if (EXTRACT_BE_16BITS(&ap->htype) == 1 && + EXTRACT_BE_16BITS(&ap->ptype) == ETHERTYPE_ATALK && ap->halen == 6 && ap->palen == 4 ) - switch (EXTRACT_16BITS(&ap->op)) { + switch (EXTRACT_BE_16BITS(&ap->op)) { case 1: /* request */ ND_PRINT((ndo, "who-has %s tell %s", AT(pdaddr), AT(psaddr))); @@ -243,8 +243,8 @@ aarp_print(netdissect_options *ndo, return; } ND_PRINT((ndo, "len %u op %u htype %u ptype %#x halen %u palen %u", - length, EXTRACT_16BITS(&ap->op), EXTRACT_16BITS(&ap->htype), - EXTRACT_16BITS(&ap->ptype), ap->halen, ap->palen)); + length, EXTRACT_BE_16BITS(&ap->op), EXTRACT_BE_16BITS(&ap->htype), + EXTRACT_BE_16BITS(&ap->ptype), ap->halen, ap->palen)); } /* @@ -280,7 +280,6 @@ static void atp_print(netdissect_options *ndo, register const struct atATP *ap, u_int length) { - char c; uint32_t data; if ((const u_char *)(ap + 1) > ndo->ndo_snapend) { @@ -298,7 +297,7 @@ atp_print(netdissect_options *ndo, case atpReqCode: ND_PRINT((ndo, " atp-req%s %d", ap->control & atpXO? " " : "*", - EXTRACT_16BITS(&ap->transID))); + EXTRACT_BE_16BITS(&ap->transID))); atp_bitmap_print(ndo, ap->bitmap); @@ -321,7 +320,7 @@ atp_print(netdissect_options *ndo, case atpRspCode: ND_PRINT((ndo, " atp-resp%s%d:%d (%u)", ap->control & atpEOM? "*" : " ", - EXTRACT_16BITS(&ap->transID), ap->bitmap, length)); + EXTRACT_BE_16BITS(&ap->transID), ap->bitmap, length)); switch (ap->control & (atpXO|atpSTS)) { case atpXO: ND_PRINT((ndo, " [XO]")); @@ -336,7 +335,7 @@ atp_print(netdissect_options *ndo, break; case atpRelCode: - ND_PRINT((ndo, " atp-rel %d", EXTRACT_16BITS(&ap->transID))); + ND_PRINT((ndo, " atp-rel %d", EXTRACT_BE_16BITS(&ap->transID))); atp_bitmap_print(ndo, ap->bitmap); @@ -346,7 +345,7 @@ atp_print(netdissect_options *ndo, /* there shouldn't be any control flags */ if (ap->control & (atpXO|atpEOM|atpSTS)) { - c = '['; + char c = '['; if (ap->control & atpXO) { ND_PRINT((ndo, "%cXO", c)); c = ','; @@ -357,7 +356,6 @@ atp_print(netdissect_options *ndo, } if (ap->control & atpSTS) { ND_PRINT((ndo, "%cSTS", c)); - c = ','; } ND_PRINT((ndo, "]")); } @@ -365,10 +363,10 @@ atp_print(netdissect_options *ndo, default: ND_PRINT((ndo, " atp-0x%x %d (%u)", ap->control, - EXTRACT_16BITS(&ap->transID), length)); + EXTRACT_BE_16BITS(&ap->transID), length)); break; } - data = EXTRACT_32BITS(&ap->userData); + data = EXTRACT_BE_32BITS(&ap->userData); if (data != 0) ND_PRINT((ndo, " 0x%x", data)); } @@ -377,7 +375,6 @@ static void atp_bitmap_print(netdissect_options *ndo, register u_char bm) { - register char c; register int i; /* @@ -386,7 +383,7 @@ atp_bitmap_print(netdissect_options *ndo, * (gcc is smart enough to eliminate it, at least on the Sparc). */ if ((bm + 1) & (bm & 0xff)) { - c = '<'; + register char c = '<'; for (i = 0; bm; ++i) { if (bm & 1) { ND_PRINT((ndo, "%c%d", c, i)); @@ -451,11 +448,11 @@ nbp_print(netdissect_options *ndo, ND_PRINT((ndo, " [ntup=%d]", np->control & 0xf)); if (tp->enumerator) ND_PRINT((ndo, " [enum=%d]", tp->enumerator)); - if (EXTRACT_16BITS(&tp->net) != snet || + if (EXTRACT_BE_16BITS(&tp->net) != snet || tp->node != snode || tp->skt != skt) ND_PRINT((ndo, " [addr=%s.%d]", - ataddr_string(ndo, EXTRACT_16BITS(&tp->net), - tp->node), tp->skt)); + ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net), + tp->node), tp->skt)); break; case nbpLkUpReply: @@ -522,9 +519,9 @@ nbp_tuple_print(netdissect_options *ndo, ND_PRINT((ndo, " %d", tp->skt)); /* if the address doesn't match the src address, it's an anomaly */ - if (EXTRACT_16BITS(&tp->net) != snet || tp->node != snode) + if (EXTRACT_BE_16BITS(&tp->net) != snet || tp->node != snode) ND_PRINT((ndo, " [addr=%s]", - ataddr_string(ndo, EXTRACT_16BITS(&tp->net), tp->node))); + ataddr_string(ndo, EXTRACT_BE_16BITS(&tp->net), tp->node))); return (tpn); }