]> The Tcpdump Group git mirrors - tcpdump/commitdiff
PTP: Fix printing the Reserved2 field
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 28 Feb 2020 18:09:41 +0000 (19:09 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 28 Feb 2020 19:33:03 +0000 (20:33 +0100)
Probably a copy & paste error.

Moreover:
Add some missing commas in output.
Fix some typos.

Update the output of a test accordingly.

print-ptp.c
tests/ptp.out

index abf0bd39e984e7b46623fb6147789d467619c67d..01ce53fd4adebd0decdaccd1d2b2ad26c4f29232 100644 (file)
  *    |                         Nano Seconds                          |
  *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *
- *  Delay Resp Message (msg type = 0x9)
+ *  Delay Resp Message (msg type=0x9)
  *     0                   1                   2                   3
  *     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  *                                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *                                    | Requesting Port Identity      |
  *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *
- *  Management Message (msg_type=0xD)
+ *  Management Message (msg type=0xD)
  *     0                   1                   2                   3
  *     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  *                                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -261,7 +261,7 @@ static const struct tok ptp_flag_values[] = {
 
 const char *p_porigin_ts = "preciseOriginTimeStamp";
 const char *p_origin_ts = "originTimeStamp";
-const char *p_recv_ts = "recieveTimeStamp";
+const char *p_recv_ts = "receiveTimeStamp";
 
 #define PTP_VER_1 0x1
 #define PTP_VER_2 0x2
@@ -374,7 +374,7 @@ static void ptp_print_2(netdissect_options *ndo, const u_char *bp, u_int length)
     len -= 4; bp += 4; sns_corr = GET_BE_U_4(bp); ND_PRINT(", sub NS correction : %u", sns_corr);
 
     /* Reserved 2 */
-    len -= 4; bp += 4; rsvd2 = GET_BE_U_4(bp); ND_PRINT(", sub NS correction : 0x%x", rsvd2);
+    len -= 4; bp += 4; rsvd2 = GET_BE_U_4(bp); ND_PRINT(", reserved2 : %u", rsvd2);
 
     /* clock identity */
     len -= 4; bp += 4; clk_id = GET_BE_U_8(bp); ND_PRINT(", clock identity : 0x%"PRIx64, clk_id);
@@ -465,7 +465,7 @@ ptp_print_timestamp(netdissect_options *ndo, const u_char *bp, u_int *len, const
     uint64_t secs;
     uint32_t nsecs;
 
-    ND_PRINT(" %s :", stype);
+    ND_PRINT(", %s :", stype);
     /* sec time stamp 6 bytes */
     secs = GET_BE_U_2(bp) + GET_BE_U_4(bp+2);
     ND_PRINT(" %"PRIu64" seconds,", secs);
@@ -487,7 +487,7 @@ ptp_print_timestamp_identity(netdissect_options *ndo,
     uint16_t port_id;
     uint64_t port_identity;
 
-    ND_PRINT(" %s :", ttype);
+    ND_PRINT(", %s :", ttype);
     /* sec time stamp 6 bytes */
     secs = GET_BE_U_2(bp) + GET_BE_U_4(bp+2);
     ND_PRINT(" %"PRIu64" seconds,", secs);
@@ -521,7 +521,7 @@ ptp_print_announce_msg(netdissect_options *ndo, const u_char *bp, u_int *len)
     uint64_t secs;
     uint32_t nsecs;
 
-    ND_PRINT(" %s :", p_origin_ts);
+    ND_PRINT(", %s :", p_origin_ts);
     /* sec time stamp 6 bytes */
     secs = GET_BE_U_2(bp) + GET_BE_U_4(bp+2);
     ND_PRINT(" %"PRIu64" seconds", secs);
index af0b7ea89034a7603a3920bc398a419a36f22868..8aac3a08c03c43aec804baf70835da6fd765f65e 100644 (file)
@@ -1,5 +1,5 @@
-    1  19:44:09.248292 IP 11.0.0.110.319 > 224.0.1.129.319: PTPv2, v1 compat : no, msg type : delay req msg, length : 44, domain : 0, reserved1 : 0, Flags [none], NS correction : 0, sub NS correction : 0, sub NS correction : 0x0, clock identity : 0x7cfe90fffef950b4, port id : 1, seq id : 132, control : 1 (delay req msg), log message interval : 127 originTimeStamp : 0 seconds, 0 nanoseconds
-    2  19:44:09.248437 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, v1 compat : no, msg type : delay resp msg, length : 54, domain : 0, reserved1 : 0, Flags [none], NS correction : 0, sub NS correction : 0, sub NS correction : 0x0, clock identity : 0x200fffe000001, port id : 1, seq id : 132, control : 3 (peer delay resp msg), log message interval : 0 recieveTimeStamp : 1516736649 seconds, 248292005 nanoseconds, port identity : 0x7cfe90fffef950b4, port id : 1
-    3  19:44:09.982883 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, v1 compat : no, msg type : announce msg, length : 64, domain : 0, reserved1 : 0, Flags [none], NS correction : 0, sub NS correction : 0, sub NS correction : 0x0, clock identity : 0x200fffe000001, port id : 1, seq id : 534, control : 5 (Other), log message interval : 1 originTimeStamp : 0 seconds 0 nanoseconds, origin cur utc :36, rsvd : 0, gm priority_1 : 128, gm clock class : 248, gm clock accuracy : 254, gm clock variance : 65535, gm priority_2 : 128, gm clock id : 0x200fffe000001, steps removed : 0, time source : 0xa0
-    4  19:44:10.034745 IP 11.0.0.9.319 > 224.0.1.129.319: PTPv2, v1 compat : no, msg type : sync msg, length : 44, domain : 0, reserved1 : 0, Flags [two step], NS correction : 0, sub NS correction : 0, sub NS correction : 0x0, clock identity : 0x200fffe000001, port id : 1, seq id : 1067, control : 0 (sync msg), log message interval : 0 originTimeStamp : 0 seconds, 0 nanoseconds
-    5  19:44:10.034796 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, v1 compat : no, msg type : follow up msg, length : 44, domain : 0, reserved1 : 0, Flags [none], NS correction : 0, sub NS correction : 0, sub NS correction : 0x0, clock identity : 0x200fffe000001, port id : 1, seq id : 1067, control : 2 (peer delay req msg), log message interval : 0 preciseOriginTimeStamp : 1516736650 seconds, 34751783 nanoseconds
+    1  19:44:09.248292 IP 11.0.0.110.319 > 224.0.1.129.319: PTPv2, v1 compat : no, msg type : delay req msg, length : 44, domain : 0, reserved1 : 0, Flags [none], NS correction : 0, sub NS correction : 0, reserved2 : 0, clock identity : 0x7cfe90fffef950b4, port id : 1, seq id : 132, control : 1 (delay req msg), log message interval : 127, originTimeStamp : 0 seconds, 0 nanoseconds
+    2  19:44:09.248437 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, v1 compat : no, msg type : delay resp msg, length : 54, domain : 0, reserved1 : 0, Flags [none], NS correction : 0, sub NS correction : 0, reserved2 : 0, clock identity : 0x200fffe000001, port id : 1, seq id : 132, control : 3 (peer delay resp msg), log message interval : 0, receiveTimeStamp : 1516736649 seconds, 248292005 nanoseconds, port identity : 0x7cfe90fffef950b4, port id : 1
+    3  19:44:09.982883 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, v1 compat : no, msg type : announce msg, length : 64, domain : 0, reserved1 : 0, Flags [none], NS correction : 0, sub NS correction : 0, reserved2 : 0, clock identity : 0x200fffe000001, port id : 1, seq id : 534, control : 5 (Other), log message interval : 1, originTimeStamp : 0 seconds 0 nanoseconds, origin cur utc :36, rsvd : 0, gm priority_1 : 128, gm clock class : 248, gm clock accuracy : 254, gm clock variance : 65535, gm priority_2 : 128, gm clock id : 0x200fffe000001, steps removed : 0, time source : 0xa0
+    4  19:44:10.034745 IP 11.0.0.9.319 > 224.0.1.129.319: PTPv2, v1 compat : no, msg type : sync msg, length : 44, domain : 0, reserved1 : 0, Flags [two step], NS correction : 0, sub NS correction : 0, reserved2 : 0, clock identity : 0x200fffe000001, port id : 1, seq id : 1067, control : 0 (sync msg), log message interval : 0, originTimeStamp : 0 seconds, 0 nanoseconds
+    5  19:44:10.034796 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, v1 compat : no, msg type : follow up msg, length : 44, domain : 0, reserved1 : 0, Flags [none], NS correction : 0, sub NS correction : 0, reserved2 : 0, clock identity : 0x200fffe000001, port id : 1, seq id : 1067, control : 2 (peer delay req msg), log message interval : 0, preciseOriginTimeStamp : 1516736650 seconds, 34751783 nanoseconds