X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/64677b0d78ff168d98c3035e894c4910c021136e..c5a34f01b4d03a0c24f9abb57f0db45c502aceb5:/print-rx.c diff --git a/print-rx.c b/print-rx.c index c60ae90c..903b26f0 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" @@ -480,8 +480,8 @@ static const struct tok rx_ack_reasons[] = { struct rx_cache_entry { uint32_t callnum; /* Call number (net order) */ - struct in_addr client; /* client IP address (net order) */ - struct in_addr server; /* server IP address (net order) */ + nd_ipv4 client; /* client IP address (net order) */ + nd_ipv4 server; /* server IP address (net order) */ u_int dport; /* server port (host order) */ uint16_t serviceId; /* Service identifier (net order) */ uint32_t opcode; /* RX opcode (host order) */ @@ -494,8 +494,8 @@ static struct rx_cache_entry rx_cache[RX_CACHE_SIZE]; static uint32_t rx_cache_next = 0; static uint32_t rx_cache_hint = 0; static void rx_cache_insert(netdissect_options *, const u_char *, const struct ip *, u_int); -static int rx_cache_find(const struct rx_header *, const struct ip *, - uint32_t, uint32_t *); +static int rx_cache_find(netdissect_options *, const struct rx_header *, + const struct ip *, uint32_t, uint32_t *); static void fs_print(netdissect_options *, const u_char *, u_int); static void fs_reply_print(netdissect_options *, const u_char *, u_int, uint32_t); @@ -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; @@ -541,26 +542,26 @@ rx_print(netdissect_options *ndo, rxh = (const struct rx_header *) bp; - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); ND_PRINT(" rx %s", tok2str(rx_types, "type %u", type)); - flags = EXTRACT_U_1(rxh->flags); + flags = GET_U_1(rxh->flags); if (ndo->ndo_vflag) { int firstflag = 0; if (ndo->ndo_vflag > 1) ND_PRINT(" cid %08x call# %u", - EXTRACT_BE_U_4(rxh->cid), - EXTRACT_BE_U_4(rxh->callNumber)); + GET_BE_U_4(rxh->cid), + GET_BE_U_4(rxh->callNumber)); ND_PRINT(" seq %u ser %u", - EXTRACT_BE_U_4(rxh->seq), - EXTRACT_BE_U_4(rxh->serial)); + GET_BE_U_4(rxh->seq), + GET_BE_U_4(rxh->serial)); if (ndo->ndo_vflag > 2) ND_PRINT(" secindex %u serviceid %hu", - EXTRACT_U_1(rxh->securityIndex), - EXTRACT_BE_U_2(rxh->serviceId)); + GET_U_1(rxh->securityIndex), + GET_BE_U_2(rxh->serviceId)); if (ndo->ndo_vflag > 1) for (i = 0; i < NUM_RX_FLAGS; i++) { @@ -588,7 +589,7 @@ rx_print(netdissect_options *ndo, */ if (type == RX_PACKET_TYPE_DATA && - EXTRACT_BE_U_4(rxh->seq) == 1 && + GET_BE_U_4(rxh->seq) == 1 && flags & RX_CLIENT_INITIATED) { /* @@ -632,10 +633,10 @@ rx_print(netdissect_options *ndo, */ } else if (((type == RX_PACKET_TYPE_DATA && - EXTRACT_BE_U_4(rxh->seq) == 1) || + GET_BE_U_4(rxh->seq) == 1) || type == RX_PACKET_TYPE_ABORT) && (flags & RX_CLIENT_INITIATED) == 0 && - rx_cache_find(rxh, (const struct ip *) bp2, + rx_cache_find(ndo, rxh, (const struct ip *) bp2, sport, &opcode)) { switch (sport) { @@ -696,12 +697,12 @@ rx_cache_insert(netdissect_options *ndo, if (++rx_cache_next >= RX_CACHE_SIZE) 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)); + rxent->callnum = GET_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)); rxent->dport = dport; - rxent->serviceId = EXTRACT_BE_U_4(rxh->serviceId); - rxent->opcode = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + rxent->serviceId = GET_BE_U_2(rxh->serviceId); + rxent->opcode = GET_BE_U_4(bp + sizeof(struct rx_header)); } /* @@ -712,26 +713,26 @@ rx_cache_insert(netdissect_options *ndo, */ static int -rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, - uint32_t *opcode) +rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh, + const struct ip *ip, u_int sport, uint32_t *opcode) { uint32_t i; struct rx_cache_entry *rxent; 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 */ i = rx_cache_hint; do { rxent = &rx_cache[i]; - if (rxent->callnum == EXTRACT_BE_U_4(rxh->callNumber) && - rxent->client.s_addr == clip && - rxent->server.s_addr == sip && - rxent->serviceId == EXTRACT_BE_U_4(rxh->serviceId) && + if (rxent->callnum == GET_BE_U_4(rxh->callNumber) && + GET_IPV4_TO_NETWORK_ORDER(rxent->client) == clip && + GET_IPV4_TO_NETWORK_ORDER(rxent->server) == sip && + rxent->serviceId == GET_BE_U_2(rxh->serviceId) && rxent->dport == sport) { /* We got a match! */ @@ -749,28 +750,28 @@ 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; \ ND_TCHECK_LEN(bp, sizeof(uint32_t) * 3); \ - n1 = EXTRACT_BE_U_4(bp); \ + n1 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n2 = EXTRACT_BE_U_4(bp); \ + n2 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n3 = EXTRACT_BE_U_4(bp); \ + n3 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" fid %u/%u/%u", n1, n2, n3); \ } #define STROUT(MAX) { uint32_t _i; \ ND_TCHECK_LEN(bp, sizeof(uint32_t)); \ - _i = EXTRACT_BE_U_4(bp); \ + _i = GET_BE_U_4(bp); \ if (_i > (MAX)) \ 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); \ @@ -778,28 +779,28 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, #define INTOUT() { int32_t _i; \ ND_TCHECK_4(bp); \ - _i = EXTRACT_BE_S_4(bp); \ + _i = GET_BE_S_4(bp); \ bp += sizeof(int32_t); \ ND_PRINT(" %d", _i); \ } #define UINTOUT() { uint32_t _i; \ ND_TCHECK_4(bp); \ - _i = EXTRACT_BE_U_4(bp); \ + _i = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" %u", _i); \ } #define UINT64OUT() { uint64_t _i; \ ND_TCHECK_LEN(bp, sizeof(uint64_t)); \ - _i = EXTRACT_BE_U_8(bp); \ + _i = GET_BE_U_8(bp); \ bp += sizeof(uint64_t); \ ND_PRINT(" %" PRIu64, _i); \ } #define DATEOUT() { time_t _t; struct tm *tm; char str[256]; \ ND_TCHECK_4(bp); \ - _t = (time_t) EXTRACT_BE_S_4(bp); \ + _t = (time_t) GET_BE_S_4(bp); \ bp += sizeof(int32_t); \ tm = localtime(&_t); \ strftime(str, 256, "%Y/%m/%d %H:%M:%S", tm); \ @@ -808,17 +809,17 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, #define STOREATTROUT() { uint32_t mask, _i; \ ND_TCHECK_LEN(bp, (sizeof(uint32_t) * 6)); \ - mask = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + mask = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask) ND_PRINT(" StoreStatus"); \ if (mask & 1) { ND_PRINT(" date"); DATEOUT(); } \ else bp += sizeof(uint32_t); \ - _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + _i = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 2) ND_PRINT(" owner %u", _i); \ - _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + _i = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 4) ND_PRINT(" group %u", _i); \ - _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + _i = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 8) ND_PRINT(" mode %o", _i & 07777); \ - _i = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \ + _i = GET_BE_U_4(bp); bp += sizeof(uint32_t); \ if (mask & 16) ND_PRINT(" segsize %u", _i); \ /* undocumented in 3.3 docu */ \ if (mask & 1024) ND_PRINT(" fsync"); \ @@ -826,26 +827,26 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, #define UBIK_VERSIONOUT() {uint32_t epoch; uint32_t counter; \ ND_TCHECK_LEN(bp, sizeof(uint32_t) * 2); \ - epoch = EXTRACT_BE_U_4(bp); \ + epoch = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - counter = EXTRACT_BE_U_4(bp); \ + counter = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" %u.%u", epoch, counter); \ } #define AFSUUIDOUT() {uint32_t temp; int _i; \ ND_TCHECK_LEN(bp, 11 * sizeof(uint32_t)); \ - temp = EXTRACT_BE_U_4(bp); \ + temp = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" %08x", temp); \ - temp = EXTRACT_BE_U_4(bp); \ + temp = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT("%04x", temp); \ - temp = EXTRACT_BE_U_4(bp); \ + temp = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT("%04x", temp); \ for (_i = 0; _i < 8; _i++) { \ - temp = EXTRACT_BE_U_4(bp); \ + temp = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT("%02x", (unsigned char) temp); \ } \ @@ -863,22 +864,22 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, ND_TCHECK_LEN(bp, (MAX) * sizeof(uint32_t)); \ sp = s; \ for (k = 0; k < (MAX); k++) { \ - *sp++ = (u_char) EXTRACT_BE_U_4(bp); \ + *sp++ = (u_char) GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ } \ s[(MAX)] = '\0'; \ ND_PRINT(" \""); \ - fn_print(ndo, s, NULL); \ + fn_print_str(ndo, s); \ ND_PRINT("\""); \ } #define DESTSERVEROUT() { uint32_t n1, n2, n3; \ ND_TCHECK_LEN(bp, sizeof(uint32_t) * 3); \ - n1 = EXTRACT_BE_U_4(bp); \ + n1 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n2 = EXTRACT_BE_U_4(bp); \ + n2 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ - n3 = EXTRACT_BE_U_4(bp); \ + n3 = GET_BE_U_4(bp); \ bp += sizeof(uint32_t); \ ND_PRINT(" server %u:%u:%u", n1, n2, n3); \ } @@ -903,7 +904,7 @@ fs_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - fs_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + fs_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" fs call %s", tok2str(fs_req, "op#%u", fs_op)); @@ -955,7 +956,7 @@ fs_print(netdissect_options *ndo, char a[AFSOPAQUEMAX+1]; FIDOUT(); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK_LEN(bp, i); i = min(AFSOPAQUEMAX, i); @@ -1012,7 +1013,7 @@ fs_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { @@ -1022,6 +1023,7 @@ fs_print(netdissect_options *ndo, } if (j == 0) ND_PRINT(" "); + break; } case 65537: /* Fetch data 64 */ FIDOUT(); @@ -1077,7 +1079,7 @@ fs_reply_print(netdissect_options *ndo, ND_PRINT(" fs reply %s", tok2str(fs_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -1090,7 +1092,7 @@ fs_reply_print(netdissect_options *ndo, { char a[AFSOPAQUEMAX+1]; ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK_LEN(bp, i); i = min(AFSOPAQUEMAX, i); @@ -1121,7 +1123,7 @@ fs_reply_print(netdissect_options *ndo, int32_t errcode; ND_TCHECK_4(bp); - errcode = EXTRACT_BE_S_4(bp); + errcode = GET_BE_S_4(bp); bp += sizeof(int32_t); ND_PRINT(" error %s", tok2str(afs_fs_errors, "#%d", errcode)); @@ -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; @@ -1189,7 +1191,7 @@ acl_print(netdissect_options *ndo, 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("}"); @@ -1203,7 +1205,7 @@ acl_print(netdissect_options *ndo, 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("}"); @@ -1238,7 +1240,7 @@ cb_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - cb_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + cb_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" cb call %s", tok2str(cb_req, "op#%u", cb_op)); @@ -1254,7 +1256,7 @@ cb_print(netdissect_options *ndo, { uint32_t j, t; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { @@ -1267,7 +1269,7 @@ cb_print(netdissect_options *ndo, ND_PRINT(" "); ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); if (j != 0) @@ -1279,10 +1281,11 @@ cb_print(netdissect_options *ndo, ND_PRINT(" expires"); DATEOUT(); ND_TCHECK_4(bp); - t = EXTRACT_BE_U_4(bp); + t = GET_BE_U_4(bp); bp += sizeof(uint32_t); tok2str(cb_types, "type %u", t); } + break; } case 214: { ND_PRINT(" afsuuid"); @@ -1322,7 +1325,7 @@ cb_reply_print(netdissect_options *ndo, ND_PRINT(" cb reply %s", tok2str(cb_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -1371,7 +1374,7 @@ prot_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - pt_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + pt_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" pt"); @@ -1424,7 +1427,7 @@ prot_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); /* @@ -1446,7 +1449,7 @@ prot_print(netdissect_options *ndo, uint32_t j; ND_PRINT(" ids:"); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (j = 0; j < i; j++) INTOUT(); @@ -1524,7 +1527,7 @@ prot_reply_print(netdissect_options *ndo, ND_PRINT(" reply %s", tok2str(pt_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -1538,7 +1541,7 @@ prot_reply_print(netdissect_options *ndo, uint32_t j; ND_PRINT(" ids:"); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (j = 0; j < i; j++) INTOUT(); @@ -1550,7 +1553,7 @@ prot_reply_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); /* @@ -1575,7 +1578,7 @@ prot_reply_print(netdissect_options *ndo, { uint32_t j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { INTOUT(); @@ -1627,7 +1630,7 @@ vldb_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - vldb_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + vldb_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" vldb"); @@ -1657,7 +1660,7 @@ vldb_print(netdissect_options *ndo, ND_PRINT(" volid"); INTOUT(); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); if (i <= 2) ND_PRINT(" type %s", voltype[i]); @@ -1677,7 +1680,7 @@ vldb_print(netdissect_options *ndo, ND_PRINT(" volid"); INTOUT(); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); if (i <= 2) ND_PRINT(" type %s", voltype[i]); @@ -1730,7 +1733,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT(" reply %s", tok2str(vldb_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -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; @@ -1752,7 +1756,7 @@ vldb_reply_print(netdissect_options *ndo, bp += sizeof(uint32_t); ND_PRINT(" numservers"); ND_TCHECK_4(bp); - nservers = EXTRACT_BE_U_4(bp); + nservers = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT(" %u", nservers); ND_PRINT(" servers"); @@ -1760,13 +1764,13 @@ 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(GET_IPV4_TO_NETWORK_ORDER(bp))); + bp += sizeof(nd_ipv4); } ND_PRINT(" partitions"); for (i = 0; i < 8; i++) { ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); if (i < nservers && j <= 26) ND_PRINT(" %c", 'a' + j); else if (i < nservers) @@ -1793,13 +1797,14 @@ 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; VECOUT(VLNAMEMAX); ND_PRINT(" numservers"); ND_TCHECK_4(bp); - nservers = EXTRACT_BE_U_4(bp); + nservers = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT(" %u", nservers); ND_PRINT(" servers"); @@ -1807,13 +1812,13 @@ 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(GET_IPV4_TO_NETWORK_ORDER(bp))); + bp += sizeof(nd_ipv4); } ND_PRINT(" partitions"); for (i = 0; i < 13; i++) { ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); if (i < nservers && j <= 26) ND_PRINT(" %c", 'a' + j); else if (i < nservers) @@ -1836,7 +1841,7 @@ vldb_reply_print(netdissect_options *ndo, VECOUT(VLNAMEMAX); ND_PRINT(" numservers"); ND_TCHECK_4(bp); - nservers = EXTRACT_BE_U_4(bp); + nservers = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT(" %u", nservers); ND_PRINT(" servers"); @@ -1854,7 +1859,7 @@ vldb_reply_print(netdissect_options *ndo, ND_PRINT(" partitions"); for (i = 0; i < 13; i++) { ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); if (i < nservers && j <= 26) ND_PRINT(" %c", 'a' + j); else if (i < nservers) @@ -1907,7 +1912,7 @@ kauth_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - kauth_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + kauth_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" kauth"); @@ -1949,7 +1954,7 @@ kauth_print(netdissect_options *ndo, ND_PRINT(" domain"); STROUT(KANAMEMAX); ND_TCHECK_4(bp); - i = EXTRACT_BE_U_4(bp); + i = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_TCHECK_LEN(bp, i); bp += i; @@ -2009,7 +2014,7 @@ kauth_reply_print(netdissect_options *ndo, ND_PRINT(" reply %s", tok2str(kauth_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -2052,7 +2057,7 @@ vol_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - vol_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + vol_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" vol call %s", tok2str(vol_req, "op#%u", vol_op)); @@ -2204,7 +2209,7 @@ vol_print(netdissect_options *ndo, { uint32_t i, j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { DESTSERVEROUT(); @@ -2255,7 +2260,7 @@ vol_reply_print(netdissect_options *ndo, ND_PRINT(" vol reply %s", tok2str(vol_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -2334,7 +2339,7 @@ vol_reply_print(netdissect_options *ndo, { uint32_t i, j; ND_TCHECK_4(bp); - j = EXTRACT_BE_U_4(bp); + j = GET_BE_U_4(bp); bp += sizeof(uint32_t); for (i = 0; i < j; i++) { ND_PRINT(" name"); @@ -2388,7 +2393,7 @@ bos_print(netdissect_options *ndo, */ ND_TCHECK_4(bp + sizeof(struct rx_header)); - bos_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + bos_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" bos call %s", tok2str(bos_req, "op#%u", bos_op)); @@ -2481,7 +2486,7 @@ bos_reply_print(netdissect_options *ndo, ND_PRINT(" bos reply %s", tok2str(bos_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -2539,7 +2544,7 @@ ubik_print(netdissect_options *ndo, * for (sizeof(rx_header) + 4) bytes, so long as it remains this way * the line below will not over-read. */ - ubik_op = EXTRACT_BE_U_4(bp + sizeof(struct rx_header)); + ubik_op = GET_BE_U_4(bp + sizeof(struct rx_header)); ND_PRINT(" ubik call %s", tok2str(ubik_req, "op#%u", ubik_op)); @@ -2552,7 +2557,7 @@ ubik_print(netdissect_options *ndo, switch (ubik_op) { case 10000: /* Beacon */ ND_TCHECK_4(bp); - temp = EXTRACT_BE_U_4(bp); + temp = GET_BE_U_4(bp); bp += sizeof(uint32_t); ND_PRINT(" syncsite %s", temp ? "yes" : "no"); ND_PRINT(" votestart"); @@ -2584,7 +2589,7 @@ ubik_print(netdissect_options *ndo, ND_PRINT(" length"); INTOUT(); ND_TCHECK_4(bp); - temp = EXTRACT_BE_U_4(bp); + temp = GET_BE_U_4(bp); bp += sizeof(uint32_t); tok2str(ubik_lock_types, "type %u", temp); break; @@ -2657,7 +2662,7 @@ ubik_reply_print(netdissect_options *ndo, ND_PRINT(" ubik reply %s", tok2str(ubik_req, "op#%u", opcode)); - type = EXTRACT_U_1(rxh->type); + type = GET_U_1(rxh->type); bp += sizeof(struct rx_header); /* @@ -2729,13 +2734,13 @@ rx_ack_print(netdissect_options *ndo, if (ndo->ndo_vflag > 2) ND_PRINT(" bufspace %u maxskew %u", - EXTRACT_BE_U_2(rxa->bufferSpace), - EXTRACT_BE_U_2(rxa->maxSkew)); + GET_BE_U_2(rxa->bufferSpace), + GET_BE_U_2(rxa->maxSkew)); - firstPacket = EXTRACT_BE_U_4(rxa->firstPacket); + firstPacket = GET_BE_U_4(rxa->firstPacket); ND_PRINT(" first %u serial %u reason %s", - firstPacket, EXTRACT_BE_U_4(rxa->serial), - tok2str(rx_ack_reasons, "#%u", EXTRACT_U_1(rxa->reason))); + firstPacket, GET_BE_U_4(rxa->serial), + tok2str(rx_ack_reasons, "#%u", GET_U_1(rxa->reason))); /* * Okay, now we print out the ack array. The way _this_ works @@ -2756,7 +2761,7 @@ rx_ack_print(netdissect_options *ndo, * to bp after this, so bp ends up at the right spot. Go figure. */ - nAcks = EXTRACT_U_1(rxa->nAcks); + nAcks = GET_U_1(rxa->nAcks); if (nAcks != 0) { ND_TCHECK_LEN(bp, nAcks); @@ -2767,7 +2772,7 @@ rx_ack_print(netdissect_options *ndo, */ for (i = 0, start = last = -2; i < nAcks; i++) - if (EXTRACT_U_1(bp + i) == RX_ACK_TYPE_ACK) { + if (GET_U_1(bp + i) == RX_ACK_TYPE_ACK) { /* * I figured this deserved _some_ explanation. @@ -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 @@ -2838,7 +2843,7 @@ rx_ack_print(netdissect_options *ndo, */ for (i = 0, start = last = -2; i < nAcks; i++) - if (EXTRACT_U_1(bp + i) == RX_ACK_TYPE_NACK) { + if (GET_U_1(bp + i) == RX_ACK_TYPE_NACK) { if (last == -2) { ND_PRINT(" nacked %u", firstPacket + i); start = i;