X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/da20bc56d6100b5275d6f85c4a25bac1dab4e57e..195a4cfd9de46b47ac6794930e19e38ed263b05f:/print-nfs.c diff --git a/print-nfs.c b/print-nfs.c index a4823842..04c98bec 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -320,10 +320,10 @@ print_sattr3(netdissect_options *ndo, void nfsreply_print(netdissect_options *ndo, - register const u_char *bp, u_int length, - register const u_char *bp2) + const u_char *bp, u_int length, + const u_char *bp2) { - register const struct sunrpc_msg *rp; + const struct sunrpc_msg *rp; char srcid[20], dstid[20]; /*fits 32bit*/ nfserr = 0; /* assume no error */ @@ -351,10 +351,10 @@ trunc: void nfsreply_noaddr_print(netdissect_options *ndo, - register const u_char *bp, u_int length, - register const u_char *bp2) + const u_char *bp, u_int length, + const u_char *bp2) { - register const struct sunrpc_msg *rp; + const struct sunrpc_msg *rp; uint32_t proc, vers, reply_stat; enum sunrpc_reject_stat rstat; uint32_t rlow; @@ -416,10 +416,10 @@ trunc: */ static const uint32_t * parsereq(netdissect_options *ndo, - register const struct sunrpc_msg *rp, register u_int length) + const struct sunrpc_msg *rp, u_int length) { - register const uint32_t *dp; - register u_int len; + const uint32_t *dp; + u_int len; /* * find the start of the req data (if we captured it) @@ -433,7 +433,7 @@ parsereq(netdissect_options *ndo, len = EXTRACT_BE_U_4(dp + 1); if (len < length) { dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp); - ND_TCHECK2(dp[0], 0); + ND_TCHECK_LEN(dp, 0); return (dp); } } @@ -447,7 +447,7 @@ trunc: */ static const uint32_t * parsefh(netdissect_options *ndo, - register const uint32_t *dp, int v3) + const uint32_t *dp, int v3) { u_int len; @@ -458,7 +458,7 @@ parsefh(netdissect_options *ndo, } else len = NFSX_V2FH / 4; - if (ND_TTEST2(*dp, len * sizeof(*dp))) { + if (ND_TTEST_LEN(dp, len * sizeof(*dp))) { nfs_printfh(ndo, dp, len); return (dp + len); } @@ -472,19 +472,19 @@ trunc: */ static const uint32_t * parsefn(netdissect_options *ndo, - register const uint32_t *dp) + const uint32_t *dp) { - register uint32_t len; - register const u_char *cp; + uint32_t len; + const u_char *cp; /* Bail if we don't have the string length */ ND_TCHECK(*dp); - /* Fetch string length; convert to host order */ - len = *dp++; - NTOHL(len); + /* Fetch big-endian string length */ + len = EXTRACT_BE_U_4(dp); + dp++; - ND_TCHECK2(*dp, ((len + 3) & ~3)); + ND_TCHECK_LEN(dp, ((len + 3) & ~3)); cp = (const u_char *)dp; /* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */ @@ -508,7 +508,7 @@ trunc: */ static const uint32_t * parsefhn(netdissect_options *ndo, - register const uint32_t *dp, int v3) + const uint32_t *dp, int v3) { dp = parsefh(ndo, dp, v3); if (dp == NULL) @@ -519,11 +519,11 @@ parsefhn(netdissect_options *ndo, void nfsreq_noaddr_print(netdissect_options *ndo, - register const u_char *bp, u_int length, - register const u_char *bp2) + const u_char *bp, u_int length, + const u_char *bp2) { - register const struct sunrpc_msg *rp; - register const uint32_t *dp; + const struct sunrpc_msg *rp; + const uint32_t *dp; nfs_type type; int v3; uint32_t proc; @@ -717,7 +717,9 @@ nfsreq_noaddr_print(netdissect_options *ndo, EXTRACT_BE_U_4(dp + 4), EXTRACT_BE_U_8(dp))); if (ndo->ndo_vflag) - ND_PRINT((ndo, " verf %08x%08x", dp[2], dp[3])); + ND_PRINT((ndo, " verf %08x%08x", + EXTRACT_BE_U_4(dp + 2), + EXTRACT_BE_U_4(dp + 3))); } else { ND_TCHECK(dp[1]); /* @@ -746,7 +748,9 @@ nfsreq_noaddr_print(netdissect_options *ndo, if (ndo->ndo_vflag) { ND_TCHECK(dp[5]); ND_PRINT((ndo, " max %u verf %08x%08x", - EXTRACT_BE_U_4(dp + 5), dp[2], dp[3])); + EXTRACT_BE_U_4(dp + 5), + EXTRACT_BE_U_4(dp + 2), + EXTRACT_BE_U_4(dp + 3))); } return; } @@ -783,7 +787,7 @@ trunc: */ static void nfs_printfh(netdissect_options *ndo, - register const uint32_t *dp, const u_int len) + const uint32_t *dp, const u_int len) { my_fsid fsid; uint32_t ino; @@ -796,7 +800,7 @@ nfs_printfh(netdissect_options *ndo, ND_PRINT((ndo, " fh[")); for (i=0; i 1) { return parse_wcc_attr(ndo, dp); } else { @@ -1366,7 +1370,8 @@ parsev3rddirres(netdissect_options *ndo, return dp; if (ndo->ndo_vflag) { ND_TCHECK(dp[1]); - ND_PRINT((ndo, " verf %08x%08x", dp[0], dp[1])); + ND_PRINT((ndo, " verf %08x%08x", + EXTRACT_BE_U_4(dp), EXTRACT_BE_U_4(dp + 1))); dp += 2; } return dp; @@ -1447,8 +1452,8 @@ static void interp_reply(netdissect_options *ndo, const struct sunrpc_msg *rp, uint32_t proc, uint32_t vers, int length) { - register const uint32_t *dp; - register int v3; + const uint32_t *dp; + int v3; int er; v3 = (vers == NFS_VER3);