Skip to content

Commit 6b40777

Browse files
cappe987fxlb
authored andcommitted
ptp: Print majorSdoId field instead of just the first bit
The 4 bits in this location are labelled transportSpecific in IEEE1588-2008. The first bit was dedicated for v1 compatible hardware, but in Annex F: "Transport over IEEE 802.3 /Ethernet" it says that a value of transportSpecific 0x1 is reserved for use by standards developed by the 802.1 AVB Task Group, which later resulted in the 802.1AS standard which uses that value. So it no longer means only v1 compat, and we should just print the whole value. 802.1AS-2020 also renames this field to majorSdoId, and that is the name used in Wireshark. Signed-off-by: Casper Andersson <[email protected]>
1 parent 63134a4 commit 6b40777

File tree

4 files changed

+217
-217
lines changed

4 files changed

+217
-217
lines changed

print-ptp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static const struct tok ptp_control_field[] = {
233233
/* mask based on the first byte */
234234
#define PTP_MAJOR_VERS_MASK 0x0F
235235
#define PTP_MINOR_VERS_MASK 0xF0
236-
#define PTP_V1_COMPAT 0x10
236+
#define PTP_MAJOR_SDO_ID_MASK 0xF0
237237
#define PTP_MSG_TYPE_MASK 0x0F
238238

239239
/*mask based 2byte */
@@ -359,15 +359,15 @@ ptp_print_2(netdissect_options *ndo, const u_char *bp, u_int length)
359359
{
360360
u_int len = length;
361361
uint16_t msg_len, flags, port_id, seq_id;
362-
uint8_t foct, domain_no, msg_type, v1_compat, rsvd1, lm_int, control;
362+
uint8_t foct, domain_no, msg_type, major_sdo_id, rsvd1, lm_int, control;
363363
uint64_t ns_corr;
364364
uint16_t sns_corr;
365365
uint32_t rsvd2;
366366
uint64_t clk_id;
367367

368368
foct = GET_U_1(bp);
369-
v1_compat = foct & PTP_V1_COMPAT;
370-
ND_PRINT(", v1 compat : %s", v1_compat?"yes":"no");
369+
major_sdo_id = (foct & PTP_MAJOR_SDO_ID_MASK) >> 4;
370+
ND_PRINT(", majorSdoId : 0x%x", major_sdo_id);
371371
msg_type = foct & PTP_MSG_TYPE_MASK;
372372
ND_PRINT(", msg type : %s", tok2str(ptp_msg_type, "Reserved", msg_type));
373373

tests/ptp.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
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), log message interval : 127, originTimeStamp : 0 seconds, 0 nanoseconds
2-
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 (Delay_Resp), log message interval : 0, receiveTimeStamp : 1516736649 seconds, 248292005 nanoseconds, port identity : 0x7cfe90fffef950b4, port id : 1
3-
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-
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), log message interval : 0, originTimeStamp : 0 seconds, 0 nanoseconds
5-
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 (Follow_Up), log message interval : 0, preciseOriginTimeStamp : 1516736650 seconds, 34751783 nanoseconds
1+
1 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 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 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 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 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 17:52:26.679146 IP 4.5.0.2.319 > 2.2.2.2.319: PTPv2, v1 compat : no, 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 17:52:26.679265 IP 2.2.2.2.320 > 4.5.0.2.320: PTPv2, v1 compat : no, 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 17:52:26.682034 IP 2.2.2.2.319 > 4.5.0.2.319: PTPv2, v1 compat : no, 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 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 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 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)