From: Francois-Xavier Le Bail Date: Fri, 19 Jan 2024 13:03:08 +0000 (+0100) Subject: PTP: Print the protocol name before any check X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/07c3f2997107c541eb00bdad450b9bd83d071de9 PTP: Print the protocol name before any check Moreover: Print (unsupported) if the version is != 1 and != 2. --- diff --git a/print-ptp.c b/print-ptp.c index 71cf59ea..4c8fc963 100644 --- a/print-ptp.c +++ b/print-ptp.c @@ -460,13 +460,14 @@ ptp_print(netdissect_options *ndo, const u_char *bp, u_int length) * version 2.1. */ ndo->ndo_protocol = "ptp"; + nd_print_protocol_caps(ndo); ND_ICHECK_U(length, <, PTP_HDR_LEN); major_vers = GET_BE_U_2(bp) & PTP_MAJOR_VERS_MASK; minor_vers = (GET_BE_U_2(bp) & PTP_MINOR_VERS_MASK) >> 4; if (minor_vers) - ND_PRINT("PTPv%u.%u", major_vers, minor_vers); + ND_PRINT("v%u.%u", major_vers, minor_vers); else - ND_PRINT("PTPv%u", major_vers); + ND_PRINT("v%u", major_vers); switch(major_vers) { case PTP_VER_1: @@ -476,7 +477,7 @@ ptp_print(netdissect_options *ndo, const u_char *bp, u_int length) ptp_print_2(ndo, bp, length); break; default: - //ND_PRINT("ERROR: unknown-version\n"); + ND_PRINT(" (unsupported)"); break; } return;