]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-vtp.c
Use nd_ types, add EXTRACT_ calls.
[tcpdump] / print-vtp.c
index d10692da903eba10b9bfb03013300d50d642f095..74601bb4c8787542e21f8623cf20de8df8c5aa43 100644 (file)
@@ -128,11 +128,11 @@ vtp_print (netdissect_options *ndo,
 
     tptr = pptr;
 
-    ND_TCHECK2(*tptr, VTP_HEADER_LEN);
+    ND_TCHECK_LEN(tptr, VTP_HEADER_LEN);
 
     type = EXTRACT_U_1(tptr + 1);
     ND_PRINT((ndo, "VTPv%u, Message %s (0x%02x), length %u",
-          *tptr,
+          EXTRACT_U_1(tptr),
           tok2str(vtp_message_type_values,"Unknown message type", type),
           type,
           length));
@@ -152,7 +152,7 @@ vtp_print (netdissect_options *ndo,
     fn_printzp(ndo, tptr + 4, mgmtd_len, NULL);
     ND_PRINT((ndo, ", %s: %u",
           tok2str(vtp_header_values, "Unknown", type),
-          *(tptr+2)));
+          EXTRACT_U_1(tptr + 2)));
 
     tptr += VTP_HEADER_LEN;
 
@@ -185,13 +185,13 @@ vtp_print (netdissect_options *ndo,
               EXTRACT_BE_U_4(tptr),
               ipaddr_string(ndo, tptr+4)));
        tptr += 8;
-       ND_TCHECK2(*tptr, VTP_UPDATE_TIMESTAMP_LEN);
+       ND_TCHECK_LEN(tptr, VTP_UPDATE_TIMESTAMP_LEN);
        ND_PRINT((ndo, ", Timestamp 0x%08x 0x%08x 0x%08x",
               EXTRACT_BE_U_4(tptr),
               EXTRACT_BE_U_4(tptr + 4),
               EXTRACT_BE_U_4(tptr + 8)));
        tptr += VTP_UPDATE_TIMESTAMP_LEN;
-       ND_TCHECK2(*tptr, VTP_MD5_DIGEST_LEN);
+       ND_TCHECK_LEN(tptr, VTP_MD5_DIGEST_LEN);
        ND_PRINT((ndo, ", MD5 digest: %08x%08x%08x%08x",
               EXTRACT_BE_U_4(tptr),
               EXTRACT_BE_U_4(tptr + 4),
@@ -244,11 +244,11 @@ vtp_print (netdissect_options *ndo,
        while (tptr < (pptr+length)) {
 
            ND_TCHECK_1(tptr);
-           len = *tptr;
+           len = EXTRACT_U_1(tptr);
            if (len == 0)
                break;
 
-           ND_TCHECK2(*tptr, len);
+           ND_TCHECK_LEN(tptr, len);
 
            vtp_vlan = (const struct vtp_vlan_*)tptr;
            if (len < VTP_VLAN_INFO_FIXED_PART_LEN)
@@ -264,7 +264,7 @@ vtp_print (netdissect_options *ndo,
            tptr += VTP_VLAN_INFO_FIXED_PART_LEN;
            if (len < 4*((vtp_vlan->name_len + 3)/4))
                goto trunc;
-           ND_TCHECK2(*tptr, vtp_vlan->name_len);
+           ND_TCHECK_LEN(tptr, vtp_vlan->name_len);
            fn_printzp(ndo, tptr, vtp_vlan->name_len, NULL);
 
            /*
@@ -287,7 +287,7 @@ vtp_print (netdissect_options *ndo,
                 if (len < 2)
                     goto trunc;
                 ND_TCHECK_2(tptr);
-                type = *tptr;
+                type = EXTRACT_U_1(tptr);
                 tlv_len = EXTRACT_U_1(tptr + 1);
 
                 ND_PRINT((ndo, "\n\t\t%s (0x%04x) TLV",
@@ -298,7 +298,7 @@ vtp_print (netdissect_options *ndo,
                     ND_PRINT((ndo, " (TLV goes past the end of the packet)"));
                     return;
                 }
-                ND_TCHECK2(*tptr, tlv_len * 2 +2);
+                ND_TCHECK_LEN(tptr, tlv_len * 2 + 2);
 
                 /*
                  * We assume the value is a 2-byte integer; the length is