Skip to content

Commit a1ed828

Browse files
committed
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 a7da9c2 commit a1ed828

File tree

3 files changed

+214
-214
lines changed

3 files changed

+214
-214
lines changed

print-ptp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static const struct tok ptp_msg_type[] = {
211211
/* mask based on the first byte */
212212
#define PTP_MAJOR_VERS_MASK 0x0F
213213
#define PTP_MINOR_VERS_MASK 0xF0
214-
#define PTP_V1_COMPAT 0x10
214+
#define PTP_MAJOR_SDO_ID_MASK 0xF0
215215
#define PTP_MSG_TYPE_MASK 0x0F
216216

217217
/*mask based 2byte */
@@ -345,13 +345,13 @@ ptp_print_2(netdissect_options *ndo, const u_char *bp, u_int length)
345345
{
346346
u_int len = length;
347347
uint16_t msg_len, flags, port_id, seq_id;
348-
uint8_t foct, domain_no, msg_type, v1_compat, rsvd1, lm_int, control;
348+
uint8_t foct, domain_no, msg_type, major_sdo_id, rsvd1, lm_int, control;
349349
uint32_t ns_corr, sns_corr, rsvd2;
350350
uint64_t clk_id;
351351

352352
foct = GET_U_1(bp);
353-
v1_compat = foct & PTP_V1_COMPAT;
354-
ND_PRINT(", v1 compat : %s", v1_compat?"yes":"no");
353+
major_sdo_id = (foct & PTP_MAJOR_SDO_ID_MASK) >> 4;
354+
ND_PRINT(", majorSdoId : 0x%x", major_sdo_id);
355355
msg_type = foct & PTP_MSG_TYPE_MASK;
356356
ND_PRINT(", msg type : %s", tok2str(ptp_msg_type, "none", msg_type));
357357

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 msg), 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 (peer delay resp msg), 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 msg), 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 (peer delay req msg), 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 msg), 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 (peer delay resp msg), 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 msg), 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 (peer delay req msg), log message interval : 0, preciseOriginTimeStamp : 1516736650 seconds, 34751783 nanoseconds

0 commit comments

Comments
 (0)