]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ptp.c
On Solaris, for 64-bit builds, use the 64-bit pcap-config.
[tcpdump] / print-ptp.c
index c6d8e544fdf74fe9c72c9cbf2ba0c35f2d755871..f4ccbe9d03a0d3198d06a8ce4ea5f33366c88179 100644 (file)
@@ -24,7 +24,6 @@
 #include "netdissect-stdinc.h"
 #include "netdissect.h"
 #include "extract.h"
-#include <string.h>
 
 /*
  * PTP header
@@ -432,14 +431,12 @@ ptp_print_2(netdissect_options *ndo, const u_char *bp, u_int length)
  * PTP general message
  */
 void
-ptp_print(netdissect_options *ndo, const u_char *bp, u_int len)
+ptp_print(netdissect_options *ndo, const u_char *bp, u_int length)
 {
     u_int vers;
 
     ndo->ndo_protocol = "ptp";
-    if (len < PTP_HDR_LEN) {
-        goto trunc;
-    }
+    ND_LCHECK_U(length, PTP_HDR_LEN);
     vers = GET_BE_U_2(bp) & PTP_VERS_MASK;
     ND_PRINT("PTPv%u",vers);
     switch(vers) {
@@ -447,7 +444,7 @@ ptp_print(netdissect_options *ndo, const u_char *bp, u_int len)
             ptp_print_1(ndo);
             break;
         case PTP_VER_2:
-            ptp_print_2(ndo, bp, len);
+            ptp_print_2(ndo, bp, length);
             break;
         default:
             //ND_PRINT("ERROR: unknown-version\n");
@@ -455,9 +452,8 @@ ptp_print(netdissect_options *ndo, const u_char *bp, u_int len)
     }
     return;
 
-trunc:
-    nd_print_trunc(ndo);
-    return;
+invalid:
+    nd_print_invalid(ndo);
 }
 
 static void