Skip to content

Commit dd2c53b

Browse files
committed
PTP: Remove spaces before colons in output
Update four test outputs accordingly.
1 parent c400801 commit dd2c53b

File tree

5 files changed

+281
-281
lines changed

5 files changed

+281
-281
lines changed

print-ptp.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -365,47 +365,47 @@ ptp_print_2(netdissect_options *ndo, const u_char *bp, u_int length)
365365

366366
foct = GET_U_1(bp);
367367
major_sdo_id = (foct & PTP_MAJOR_SDO_ID_MASK) >> 4;
368-
ND_PRINT(", majorSdoId : 0x%x", major_sdo_id);
368+
ND_PRINT(", majorSdoId: 0x%x", major_sdo_id);
369369
msg_type = foct & PTP_MSG_TYPE_MASK;
370-
ND_PRINT(", msg type : %s", tok2str(ptp_msg_type, "Reserved", msg_type));
370+
ND_PRINT(", msg type: %s", tok2str(ptp_msg_type, "Reserved", msg_type));
371371

372372
/* msg length */
373-
len -= 2; bp += 2; msg_len = GET_BE_U_2(bp); ND_PRINT(", length : %u", msg_len);
373+
len -= 2; bp += 2; msg_len = GET_BE_U_2(bp); ND_PRINT(", length: %u", msg_len);
374374

375375
/* domain */
376-
len -= 2; bp += 2; domain_no = (GET_BE_U_2(bp) & PTP_DOMAIN_MASK) >> 8; ND_PRINT(", domain : %u", domain_no);
376+
len -= 2; bp += 2; domain_no = (GET_BE_U_2(bp) & PTP_DOMAIN_MASK) >> 8; ND_PRINT(", domain: %u", domain_no);
377377

378378
/* rsvd 1*/
379379
rsvd1 = GET_BE_U_2(bp) & PTP_RSVD1_MASK;
380-
ND_PRINT(", reserved1 : %u", rsvd1);
380+
ND_PRINT(", reserved1: %u", rsvd1);
381381

382382
/* flags */
383383
len -= 2; bp += 2; flags = GET_BE_U_2(bp); ND_PRINT(", Flags [%s]", bittok2str(ptp_flag_values, "none", flags));
384384

385385
/* correction NS (48 bits) */
386-
len -= 2; bp += 2; ns_corr = GET_BE_U_6(bp); ND_PRINT(", NS correction : %"PRIu64, ns_corr);
386+
len -= 2; bp += 2; ns_corr = GET_BE_U_6(bp); ND_PRINT(", NS correction: %"PRIu64, ns_corr);
387387

388388
/* correction sub NS (16 bits) */
389-
len -= 6; bp += 6; sns_corr = GET_BE_U_2(bp); ND_PRINT(", sub NS correction : %u", sns_corr);
389+
len -= 6; bp += 6; sns_corr = GET_BE_U_2(bp); ND_PRINT(", sub NS correction: %u", sns_corr);
390390

391391
/* Reserved 2 */
392-
len -= 2; bp += 2; rsvd2 = GET_BE_U_4(bp); ND_PRINT(", reserved2 : %u", rsvd2);
392+
len -= 2; bp += 2; rsvd2 = GET_BE_U_4(bp); ND_PRINT(", reserved2: %u", rsvd2);
393393

394394
/* clock identity */
395-
len -= 4; bp += 4; clk_id = GET_BE_U_8(bp); ND_PRINT(", clock identity : 0x%"PRIx64, clk_id);
395+
len -= 4; bp += 4; clk_id = GET_BE_U_8(bp); ND_PRINT(", clock identity: 0x%"PRIx64, clk_id);
396396

397397
/* port identity */
398-
len -= 8; bp += 8; port_id = GET_BE_U_2(bp); ND_PRINT(", port id : %u", port_id);
398+
len -= 8; bp += 8; port_id = GET_BE_U_2(bp); ND_PRINT(", port id: %u", port_id);
399399

400400
/* sequence ID */
401-
len -= 2; bp += 2; seq_id = GET_BE_U_2(bp); ND_PRINT(", seq id : %u", seq_id);
401+
len -= 2; bp += 2; seq_id = GET_BE_U_2(bp); ND_PRINT(", seq id: %u", seq_id);
402402

403403
/* control */
404404
len -= 2; bp += 2; control = GET_U_1(bp) ;
405-
ND_PRINT(", control : %u (%s)", control, tok2str(ptp_control_field, "Reserved", control));
405+
ND_PRINT(", control: %u (%s)", control, tok2str(ptp_control_field, "Reserved", control));
406406

407407
/* log message interval */
408-
lm_int = GET_BE_U_2(bp) & PTP_LOGMSG_MASK; ND_PRINT(", log message interval : %u", lm_int); len -= 2; bp += 2;
408+
lm_int = GET_BE_U_2(bp) & PTP_LOGMSG_MASK; ND_PRINT(", log message interval: %u", lm_int); len -= 2; bp += 2;
409409

410410
switch(msg_type) {
411411
case M_SYNC:
@@ -490,7 +490,7 @@ ptp_print_timestamp(netdissect_options *ndo, const u_char *bp, u_int *len, const
490490
uint64_t secs;
491491
uint32_t nsecs;
492492

493-
ND_PRINT(", %s :", stype);
493+
ND_PRINT(", %s:", stype);
494494
/* sec time stamp 6 bytes */
495495
secs = GET_BE_U_6(bp);
496496
ND_PRINT(" %"PRIu64" seconds,", secs);
@@ -512,7 +512,7 @@ ptp_print_timestamp_identity(netdissect_options *ndo,
512512
uint16_t port_id;
513513
uint64_t port_identity;
514514

515-
ND_PRINT(", %s :", ttype);
515+
ND_PRINT(", %s:", ttype);
516516
/* sec time stamp 6 bytes */
517517
secs = GET_BE_U_6(bp);
518518
ND_PRINT(" %"PRIu64" seconds,", secs);
@@ -527,13 +527,13 @@ ptp_print_timestamp_identity(netdissect_options *ndo,
527527

528528
/* port identity*/
529529
port_identity = GET_BE_U_8(bp);
530-
ND_PRINT(", port identity : 0x%"PRIx64, port_identity);
530+
ND_PRINT(", port identity: 0x%"PRIx64, port_identity);
531531
*len -= 8;
532532
bp += 8;
533533

534534
/* port id */
535535
port_id = GET_BE_U_2(bp);
536-
ND_PRINT(", port id : %u", port_id);
536+
ND_PRINT(", port id: %u", port_id);
537537
*len -= 2;
538538
bp += 2;
539539
}
@@ -546,7 +546,7 @@ ptp_print_announce_msg(netdissect_options *ndo, const u_char *bp, u_int *len)
546546
uint64_t secs;
547547
uint32_t nsecs;
548548

549-
ND_PRINT(", %s :", p_origin_ts);
549+
ND_PRINT(", %s:", p_origin_ts);
550550
/* sec time stamp 6 bytes */
551551
secs = GET_BE_U_6(bp);
552552
ND_PRINT(" %"PRIu64" seconds", secs);
@@ -561,56 +561,56 @@ ptp_print_announce_msg(netdissect_options *ndo, const u_char *bp, u_int *len)
561561

562562
/* origin cur utc */
563563
origin_cur_utc = GET_BE_U_2(bp);
564-
ND_PRINT(", origin cur utc :%u", origin_cur_utc);
564+
ND_PRINT(", origin cur utc:%u", origin_cur_utc);
565565
*len -= 2;
566566
bp += 2;
567567

568568
/* rsvd */
569569
rsvd = GET_U_1(bp);
570-
ND_PRINT(", rsvd : %u", rsvd);
570+
ND_PRINT(", rsvd: %u", rsvd);
571571
*len -= 1;
572572
bp += 1;
573573

574574
/* gm prio */
575575
gm_prio_1 = GET_U_1(bp);
576-
ND_PRINT(", gm priority_1 : %u", gm_prio_1);
576+
ND_PRINT(", gm priority_1: %u", gm_prio_1);
577577
*len -= 1;
578578
bp += 1;
579579

580580
/* GM clock class */
581581
gm_clk_cls = GET_U_1(bp);
582-
ND_PRINT(", gm clock class : %u", gm_clk_cls);
582+
ND_PRINT(", gm clock class: %u", gm_clk_cls);
583583
*len -= 1;
584584
bp += 1;
585585
/* GM clock accuracy */
586586
gm_clk_acc = GET_U_1(bp);
587-
ND_PRINT(", gm clock accuracy : %u", gm_clk_acc);
587+
ND_PRINT(", gm clock accuracy: %u", gm_clk_acc);
588588
*len -= 1;
589589
bp += 1;
590590
/* GM clock variance */
591591
gm_clk_var = GET_BE_U_2(bp);
592-
ND_PRINT(", gm clock variance : %u", gm_clk_var);
592+
ND_PRINT(", gm clock variance: %u", gm_clk_var);
593593
*len -= 2;
594594
bp += 2;
595595
/* GM Prio 2 */
596596
gm_prio_2 = GET_U_1(bp);
597-
ND_PRINT(", gm priority_2 : %u", gm_prio_2);
597+
ND_PRINT(", gm priority_2: %u", gm_prio_2);
598598
*len -= 1;
599599
bp += 1;
600600

601601
/* GM Clock Identity */
602602
gm_clock_id = GET_BE_U_8(bp);
603-
ND_PRINT(", gm clock id : 0x%"PRIx64, gm_clock_id);
603+
ND_PRINT(", gm clock id: 0x%"PRIx64, gm_clock_id);
604604
*len -= 8;
605605
bp += 8;
606606
/* steps removed */
607607
steps_removed = GET_BE_U_2(bp);
608-
ND_PRINT(", steps removed : %u", steps_removed);
608+
ND_PRINT(", steps removed: %u", steps_removed);
609609
*len -= 2;
610610
bp += 2;
611611
/* Time source */
612612
time_src = GET_U_1(bp);
613-
ND_PRINT(", time source : 0x%x", time_src);
613+
ND_PRINT(", time source: 0x%x", time_src);
614614
*len -= 1;
615615
bp += 1;
616616

@@ -623,13 +623,13 @@ ptp_print_port_id(netdissect_options *ndo, const u_char *bp, u_int *len)
623623

624624
/* port identity*/
625625
port_identity = GET_BE_U_8(bp);
626-
ND_PRINT(", port identity : 0x%"PRIx64, port_identity);
626+
ND_PRINT(", port identity: 0x%"PRIx64, port_identity);
627627
*len -= 8;
628628
bp += 8;
629629

630630
/* port id */
631631
port_id = GET_BE_U_2(bp);
632-
ND_PRINT(", port id : %u", port_id);
632+
ND_PRINT(", port id: %u", port_id);
633633
*len -= 2;
634634
bp += 2;
635635

tests/ptp.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
1 2018-01-23 19:44:09.248292 IP 11.0.0.110.319 > 224.0.1.129.319: PTPv2, majorSdoId : 0x0, 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), log message interval : 127, originTimeStamp : 0 seconds, 0 nanoseconds
2-
2 2018-01-23 19:44:09.248437 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, majorSdoId : 0x0, 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 (Delay_Resp), log message interval : 0, receiveTimeStamp : 1516736649 seconds, 248292005 nanoseconds, port identity : 0x7cfe90fffef950b4, port id : 1
3-
3 2018-01-23 19:44:09.982883 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, majorSdoId : 0x0, 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-
4 2018-01-23 19:44:10.034745 IP 11.0.0.9.319 > 224.0.1.129.319: PTPv2, majorSdoId : 0x0, 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), log message interval : 0, originTimeStamp : 0 seconds, 0 nanoseconds
5-
5 2018-01-23 19:44:10.034796 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, majorSdoId : 0x0, 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 (Follow_Up), log message interval : 0, preciseOriginTimeStamp : 1516736650 seconds, 34751783 nanoseconds
1+
1 2018-01-23 19:44:09.248292 IP 11.0.0.110.319 > 224.0.1.129.319: PTPv2, majorSdoId: 0x0, 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), log message interval: 127, originTimeStamp: 0 seconds, 0 nanoseconds
2+
2 2018-01-23 19:44:09.248437 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, majorSdoId: 0x0, 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 (Delay_Resp), log message interval: 0, receiveTimeStamp: 1516736649 seconds, 248292005 nanoseconds, port identity: 0x7cfe90fffef950b4, port id: 1
3+
3 2018-01-23 19:44:09.982883 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, majorSdoId: 0x0, 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+
4 2018-01-23 19:44:10.034745 IP 11.0.0.9.319 > 224.0.1.129.319: PTPv2, majorSdoId: 0x0, 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), log message interval: 0, originTimeStamp: 0 seconds, 0 nanoseconds
5+
5 2018-01-23 19:44:10.034796 IP 11.0.0.9.320 > 224.0.1.129.320: PTPv2, majorSdoId: 0x0, 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 (Follow_Up), log message interval: 0, preciseOriginTimeStamp: 1516736650 seconds, 34751783 nanoseconds

tests/ptp_corrections.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
1 2022-10-11 17:52:26.679146 IP 4.5.0.2.319 > 2.2.2.2.319: PTPv2, majorSdoId : 0x0, msg type : delay req msg, length : 44, domain : 44, reserved1 : 0, Flags [unicast], NS correction : 0, sub NS correction : 0, reserved2 : 0, clock identity : 0xa0369ffffe856e8a, port id : 1, seq id : 1203, control : 1 (Delay_Req), log message interval : 127, originTimeStamp : 0 seconds, 0 nanoseconds
2-
2 2022-10-11 17:52:26.679265 IP 2.2.2.2.320 > 4.5.0.2.320: PTPv2, majorSdoId : 0x0, msg type : delay resp msg, length : 54, domain : 44, reserved1 : 0, Flags [unicast], NS correction : 36035, sub NS correction : 0, reserved2 : 0, clock identity : 0xe8c57affff01313f, port id : 3, seq id : 1203, control : 3 (Delay_Resp), log message interval : 127, receiveTimeStamp : 1665510783 seconds, 679015501 nanoseconds, port identity : 0xa0369ffffe856e8a, port id : 1
3-
3 2022-10-11 17:52:26.682034 IP 2.2.2.2.319 > 4.5.0.2.319: PTPv2, majorSdoId : 0x0, msg type : sync msg, length : 44, domain : 44, reserved1 : 0, Flags [unicast], NS correction : 105045, sub NS correction : 0, reserved2 : 0, clock identity : 0xe8c57affff01313f, port id : 3, seq id : 1213, control : 0 (Sync), log message interval : 127, originTimeStamp : 1665510783 seconds, 681548698 nanoseconds
1+
1 2022-10-11 17:52:26.679146 IP 4.5.0.2.319 > 2.2.2.2.319: PTPv2, majorSdoId: 0x0, msg type: delay req msg, length: 44, domain: 44, reserved1: 0, Flags [unicast], NS correction: 0, sub NS correction: 0, reserved2: 0, clock identity: 0xa0369ffffe856e8a, port id: 1, seq id: 1203, control: 1 (Delay_Req), log message interval: 127, originTimeStamp: 0 seconds, 0 nanoseconds
2+
2 2022-10-11 17:52:26.679265 IP 2.2.2.2.320 > 4.5.0.2.320: PTPv2, majorSdoId: 0x0, msg type: delay resp msg, length: 54, domain: 44, reserved1: 0, Flags [unicast], NS correction: 36035, sub NS correction: 0, reserved2: 0, clock identity: 0xe8c57affff01313f, port id: 3, seq id: 1203, control: 3 (Delay_Resp), log message interval: 127, receiveTimeStamp: 1665510783 seconds, 679015501 nanoseconds, port identity: 0xa0369ffffe856e8a, port id: 1
3+
3 2022-10-11 17:52:26.682034 IP 2.2.2.2.319 > 4.5.0.2.319: PTPv2, majorSdoId: 0x0, msg type: sync msg, length: 44, domain: 44, reserved1: 0, Flags [unicast], NS correction: 105045, sub NS correction: 0, reserved2: 0, clock identity: 0xe8c57affff01313f, port id: 3, seq id: 1213, control: 0 (Sync), log message interval: 127, originTimeStamp: 1665510783 seconds, 681548698 nanoseconds

0 commit comments

Comments
 (0)