X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/e2982e7f6f0b624a773ec5a58885ee80fab46d34..0b3880c91e169db7cfbdce1b18ef4f1e3fd277de:/print-rx.c diff --git a/print-rx.c b/print-rx.c index 882e8003..5e0315ef 100644 --- a/print-rx.c +++ b/print-rx.c @@ -36,13 +36,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include #include #include -#include +#include "netdissect-stdinc.h" #include "netdissect.h" #include "addrtoname.h" @@ -534,6 +534,7 @@ rx_print(netdissect_options *ndo, uint8_t type, flags; uint32_t opcode; + ndo->ndo_protocol = "rx"; if (!ND_TTEST_LEN(bp, sizeof(struct rx_header))) { ND_PRINT(" [|rx] (%u)", length); return; @@ -697,8 +698,8 @@ rx_cache_insert(netdissect_options *ndo, rx_cache_next = 0; rxent->callnum = EXTRACT_BE_U_4(rxh->callNumber); - UNALIGNED_MEMCPY(&rxent->client, &ip->ip_src, sizeof(uint32_t)); - UNALIGNED_MEMCPY(&rxent->server, &ip->ip_dst, sizeof(uint32_t)); + UNALIGNED_MEMCPY(&rxent->client, ip->ip_src, sizeof(uint32_t)); + UNALIGNED_MEMCPY(&rxent->server, ip->ip_dst, sizeof(uint32_t)); rxent->dport = dport; rxent->serviceId = EXTRACT_BE_U_4(rxh->serviceId); rxent->opcode = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); @@ -720,8 +721,8 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, uint32_t clip; uint32_t sip; - UNALIGNED_MEMCPY(&clip, &ip->ip_dst, sizeof(uint32_t)); - UNALIGNED_MEMCPY(&sip, &ip->ip_src, sizeof(uint32_t)); + UNALIGNED_MEMCPY(&clip, ip->ip_dst, sizeof(uint32_t)); + UNALIGNED_MEMCPY(&sip, ip->ip_src, sizeof(uint32_t)); /* Start the search where we last left off */ @@ -749,7 +750,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, } /* - * These extrememly grody macros handle the printing of various AFS stuff. + * These extremely grody macros handle the printing of various AFS stuff. */ #define FIDOUT() { uint32_t n1, n2, n3; \ @@ -770,7 +771,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, goto trunc; \ bp += sizeof(uint32_t); \ ND_PRINT(" \""); \ - if (fn_printn(ndo, bp, _i, ndo->ndo_snapend)) \ + if (nd_printn(ndo, bp, _i, ndo->ndo_snapend)) \ goto trunc; \ ND_PRINT("\""); \ bp += ((_i + sizeof(uint32_t) - 1) / sizeof(uint32_t)) * sizeof(uint32_t); \ @@ -868,7 +869,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, } \ s[(MAX)] = '\0'; \ ND_PRINT(" \""); \ - fn_print(ndo, s, NULL); \ + fn_print_str(ndo, s); \ ND_PRINT("\""); \ } @@ -1022,6 +1023,7 @@ fs_print(netdissect_options *ndo, } if (j == 0) ND_PRINT(" "); + break; } case 65537: /* Fetch data 64 */ FIDOUT(); @@ -1159,7 +1161,7 @@ acl_print(netdissect_options *ndo, char fmt[1024]; if ((user = (char *)malloc(maxsize)) == NULL) - return; + (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC, "acl_print: malloc"); if (sscanf((char *) s, "%d %d\n%n", &pos, &neg, &n) != 2) goto finish; @@ -1184,12 +1186,12 @@ acl_print(netdissect_options *ndo, acl & PRSFS_ADMINISTER ? "a" : ""); for (i = 0; i < pos; i++) { - snprintf(fmt, sizeof(fmt), "%%%ds %%d\n%%n", maxsize - 1); + nd_snprintf(fmt, sizeof(fmt), "%%%ds %%d\n%%n", maxsize - 1); if (sscanf((char *) s, fmt, user, &acl, &n) != 2) goto finish; s += n; ND_PRINT(" +{"); - fn_print(ndo, (u_char *)user, NULL); + fn_print_str(ndo, (u_char *)user); ND_PRINT(" "); ACLOUT(acl); ND_PRINT("}"); @@ -1198,12 +1200,12 @@ acl_print(netdissect_options *ndo, } for (i = 0; i < neg; i++) { - snprintf(fmt, sizeof(fmt), "%%%ds %%d\n%%n", maxsize - 1); + nd_snprintf(fmt, sizeof(fmt), "%%%ds %%d\n%%n", maxsize - 1); if (sscanf((char *) s, fmt, user, &acl, &n) != 2) goto finish; s += n; ND_PRINT(" -{"); - fn_print(ndo, (u_char *)user, NULL); + fn_print_str(ndo, (u_char *)user); ND_PRINT(" "); ACLOUT(acl); ND_PRINT("}"); @@ -1283,6 +1285,7 @@ cb_print(netdissect_options *ndo, bp += sizeof(uint32_t); tok2str(cb_types, "type %u", t); } + break; } case 214: { ND_PRINT(" afsuuid"); @@ -1744,6 +1747,7 @@ vldb_reply_print(netdissect_options *ndo, INTOUT(); ND_PRINT(" nextindex"); INTOUT(); + ND_FALL_THROUGH; case 503: /* Get entry by id */ case 504: /* Get entry by name */ { uint32_t nservers, j; @@ -1760,8 +1764,8 @@ vldb_reply_print(netdissect_options *ndo, ND_TCHECK_4(bp); if (i < nservers) ND_PRINT(" %s", - intoa(((const struct in_addr *) bp)->s_addr)); - bp += sizeof(uint32_t); + intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(bp))); + bp += sizeof(nd_ipv4); } ND_PRINT(" partitions"); for (i = 0; i < 8; i++) { @@ -1793,6 +1797,7 @@ vldb_reply_print(netdissect_options *ndo, INTOUT(); ND_PRINT(" nextindex"); INTOUT(); + ND_FALL_THROUGH; case 518: /* Get entry by ID N */ case 519: /* Get entry by name N */ { uint32_t nservers, j; @@ -1807,8 +1812,8 @@ vldb_reply_print(netdissect_options *ndo, ND_TCHECK_4(bp); if (i < nservers) ND_PRINT(" %s", - intoa(((const struct in_addr *) bp)->s_addr)); - bp += sizeof(uint32_t); + intoa(EXTRACT_IPV4_TO_NETWORK_ORDER(bp))); + bp += sizeof(nd_ipv4); } ND_PRINT(" partitions"); for (i = 0; i < 13; i++) { @@ -2728,7 +2733,7 @@ rx_ack_print(netdissect_options *ndo, */ if (ndo->ndo_vflag > 2) - ND_PRINT(" bufspace %u maxskew %d", + ND_PRINT(" bufspace %u maxskew %u", EXTRACT_BE_U_2(rxa->bufferSpace), EXTRACT_BE_U_2(rxa->maxSkew)); @@ -2786,7 +2791,7 @@ rx_ack_print(netdissect_options *ndo, * the range (such as an nacked packet in * the middle of some acked packets), * then print the current packet number - * seperated from the last number by + * separated from the last number by * a comma. */ @@ -2809,7 +2814,7 @@ rx_ack_print(netdissect_options *ndo, * we hit a nack ... in _this_ case we * want to print out the range of packets * that were acked, so we need to print - * the _previous_ packet number seperated + * the _previous_ packet number separated * from the first by a dash (-). Since we * already printed the first packet above, * just print the final packet. Don't