]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-sunrpc.c
Remove more old-compiler compensation.
[tcpdump] / print-sunrpc.c
index 74e9db384da130bd7a0b6869743972dd5810cee3..94b867075b543d6ef7ca4a37a4270efbae6f2536 100644 (file)
@@ -167,30 +167,32 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp,
        uint32_t x;
        char srcid[20], dstid[20];      /*fits 32bit*/
 
+       ndo->ndo_protocol = "sunrpc";
        rp = (const struct sunrpc_msg *)bp;
+       ND_TCHECK_SIZE(rp);
 
        if (!ndo->ndo_nflag) {
-               nd_snprintf(srcid, sizeof(srcid), "0x%x",
-                   EXTRACT_BE_U_4(rp->rm_xid));
+               snprintf(srcid, sizeof(srcid), "0x%x",
+                   GET_BE_U_4(rp->rm_xid));
                strlcpy(dstid, "sunrpc", sizeof(dstid));
        } else {
-               nd_snprintf(srcid, sizeof(srcid), "0x%x",
-                   EXTRACT_BE_U_4(rp->rm_xid));
-               nd_snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT);
+               snprintf(srcid, sizeof(srcid), "0x%x",
+                   GET_BE_U_4(rp->rm_xid));
+               snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT);
        }
 
        switch (IP_V((const struct ip *)bp2)) {
        case 4:
                ip = (const struct ip *)bp2;
                ND_PRINT("%s.%s > %s.%s: %u",
-                   ipaddr_string(ndo, &ip->ip_src), srcid,
-                   ipaddr_string(ndo, &ip->ip_dst), dstid, length);
+                   ipaddr_string(ndo, ip->ip_src), srcid,
+                   ipaddr_string(ndo, ip->ip_dst), dstid, length);
                break;
        case 6:
                ip6 = (const struct ip6_hdr *)bp2;
                ND_PRINT("%s.%s > %s.%s: %u",
-                   ip6addr_string(ndo, &ip6->ip6_src), srcid,
-                   ip6addr_string(ndo, &ip6->ip6_dst), dstid, length);
+                   ip6addr_string(ndo, ip6->ip6_src), srcid,
+                   ip6addr_string(ndo, ip6->ip6_dst), dstid, length);
                break;
        default:
                ND_PRINT("%s.%s > %s.%s: %u", "?", srcid, "?", dstid, length);
@@ -198,25 +200,29 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp,
        }
 
        ND_PRINT(" %s", tok2str(proc2str, " proc #%u",
-           EXTRACT_BE_U_4(rp->rm_call.cb_proc)));
-       x = EXTRACT_BE_U_4(rp->rm_call.cb_rpcvers);
+           GET_BE_U_4(rp->rm_call.cb_proc)));
+       x = GET_BE_U_4(rp->rm_call.cb_rpcvers);
        if (x != 2)
                ND_PRINT(" [rpcver %u]", x);
 
-       switch (EXTRACT_BE_U_4(rp->rm_call.cb_proc)) {
+       switch (GET_BE_U_4(rp->rm_call.cb_proc)) {
 
        case SUNRPC_PMAPPROC_SET:
        case SUNRPC_PMAPPROC_UNSET:
        case SUNRPC_PMAPPROC_GETPORT:
        case SUNRPC_PMAPPROC_CALLIT:
-               x = EXTRACT_BE_U_4(rp->rm_call.cb_prog);
+               x = GET_BE_U_4(rp->rm_call.cb_prog);
                if (!ndo->ndo_nflag)
                        ND_PRINT(" %s", progstr(x));
                else
                        ND_PRINT(" %u", x);
-               ND_PRINT(".%u", EXTRACT_BE_U_4(rp->rm_call.cb_vers));
+               ND_PRINT(".%u", GET_BE_U_4(rp->rm_call.cb_vers));
                break;
        }
+       return;
+
+trunc:
+       nd_print_trunc(ndo);
 }
 
 static char *
@@ -234,7 +240,7 @@ progstr(uint32_t prog)
        rp = getrpcbynumber(prog);
        if (rp == NULL)
 #endif
-               (void) nd_snprintf(buf, sizeof(buf), "#%u", prog);
+               (void) snprintf(buf, sizeof(buf), "#%u", prog);
 #if defined(HAVE_GETRPCBYNUMBER) && defined(HAVE_RPC_RPC_H)
        else
                strlcpy(buf, rp->r_name, sizeof(buf));