]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-vqp.c
the failed/passed count was not kept in the right place
[tcpdump] / print-vqp.c
index ab00a79961eb7d0044237fcdd7ba9fa3b8634ec2..b0fba902039ef003bf8884efc44984c82b768223 100644 (file)
@@ -115,7 +115,7 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
     ND_TCHECK_SIZE(vqp_common_header);
     if (sizeof(struct vqp_common_header_t) > tlen)
         goto trunc;
-    version = EXTRACT_U_1(vqp_common_header->version);
+    version = GET_U_1(vqp_common_header->version);
 
     /*
      * Sanity checking of the header.
@@ -130,22 +130,22 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
     if (ndo->ndo_vflag < 1) {
         ND_PRINT("VQPv%u %s Message, error-code %s (%u), length %u",
                version,
-               tok2str(vqp_msg_type_values, "unknown (%u)",EXTRACT_U_1(vqp_common_header->msg_type)),
-               tok2str(vqp_error_code_values, "unknown (%u)",EXTRACT_U_1(vqp_common_header->error_code)),
-              EXTRACT_U_1(vqp_common_header->error_code),
+               tok2str(vqp_msg_type_values, "unknown (%u)",GET_U_1(vqp_common_header->msg_type)),
+               tok2str(vqp_error_code_values, "unknown (%u)",GET_U_1(vqp_common_header->error_code)),
+               GET_U_1(vqp_common_header->error_code),
                len);
         return;
     }
 
     /* ok they seem to want to know everything - lets fully decode it */
-    nitems = EXTRACT_U_1(vqp_common_header->nitems);
+    nitems = GET_U_1(vqp_common_header->nitems);
     ND_PRINT("\n\tVQPv%u, %s Message, error-code %s (%u), seq 0x%08x, items %u, length %u",
            version,
-          tok2str(vqp_msg_type_values, "unknown (%u)",EXTRACT_U_1(vqp_common_header->msg_type)),
-          tok2str(vqp_error_code_values, "unknown (%u)",EXTRACT_U_1(vqp_common_header->error_code)),
-          EXTRACT_U_1(vqp_common_header->error_code),
-           EXTRACT_BE_U_4(vqp_common_header->sequence),
-           nitems,
+          tok2str(vqp_msg_type_values, "unknown (%u)",GET_U_1(vqp_common_header->msg_type)),
+          tok2str(vqp_error_code_values, "unknown (%u)",GET_U_1(vqp_common_header->error_code)),
+          GET_U_1(vqp_common_header->error_code),
+          GET_BE_U_4(vqp_common_header->sequence),
+          nitems,
            len);
 
     /* skip VQP Common header */
@@ -158,8 +158,8 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
         ND_TCHECK_SIZE(vqp_obj_tlv);
         if (sizeof(struct vqp_obj_tlv_t) > tlen)
             goto trunc;
-        vqp_obj_type = EXTRACT_BE_U_4(vqp_obj_tlv->obj_type);
-        vqp_obj_len = EXTRACT_BE_U_2(vqp_obj_tlv->obj_length);
+        vqp_obj_type = GET_BE_U_4(vqp_obj_tlv->obj_type);
+        vqp_obj_len = GET_BE_U_2(vqp_obj_tlv->obj_length);
         tptr+=sizeof(struct vqp_obj_tlv_t);
         tlen-=sizeof(struct vqp_obj_tlv_t);
 
@@ -181,14 +181,15 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
        case VQP_OBJ_IP_ADDRESS:
             if (vqp_obj_len != 4)
                 goto trunc;
-            ND_PRINT("%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_BE_U_4(tptr));
+            ND_PRINT("%s (0x%08x)", ipaddr_string(ndo, tptr),
+                     GET_BE_U_4(tptr));
             break;
             /* those objects have similar semantics - fall through */
         case VQP_OBJ_PORT_NAME:
        case VQP_OBJ_VLAN_NAME:
        case VQP_OBJ_VTP_DOMAIN:
        case VQP_OBJ_ETHERNET_PKT:
-            safeputs(ndo, tptr, vqp_obj_len);
+            (void)nd_printzp(ndo, tptr, vqp_obj_len, NULL);
             break;
             /* those objects have similar semantics - fall through */
        case VQP_OBJ_MAC_ADDRESS:
@@ -208,5 +209,5 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
     }
     return;
 trunc:
-    ND_PRINT("\n\t[|VQP]");
+    nd_print_trunc(ndo);
 }