According to IEEE Std 1588-2019 Chapter 6.4 PTP message classes, all PTP messages can be extended by means of a standard Type, Length, Value (TLV) extension mechanism.
Avnu conformance tests for 802.1AS-2020 do validate whether the device can properly ignore unknown TLVs in received PTP messages. With the present code, we observed "bad message" error when the device receives Sync, Pdelay_Req and Pdelay_Resp event messages with unknown TLV appended. This error is due to PTP event messages are not enabled/allowed to carry TLV yet. To fix the problem, we have to append TLV onto the PTP event messages. v2: Fix commit message Signed-off-by: Tan Tee Min <tee.min....@linux.intel.com> --- msg.c | 6 +++--- msg.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/msg.c b/msg.c index c2d358b..ab841f0 100644 --- a/msg.c +++ b/msg.c @@ -100,13 +100,13 @@ static uint8_t *msg_suffix(struct ptp_message *m) { switch (msg_type(m)) { case SYNC: - return NULL; + return m->sync.suffix; case DELAY_REQ: return m->delay_req.suffix; case PDELAY_REQ: - return NULL; + return m->pdelay_req.suffix; case PDELAY_RESP: - return NULL; + return m->pdelay_resp.suffix; case FOLLOW_UP: return m->follow_up.suffix; case DELAY_RESP: diff --git a/msg.h b/msg.h index b7423ee..e3744dc 100644 --- a/msg.h +++ b/msg.h @@ -124,6 +124,7 @@ struct announce_msg { struct sync_msg { struct ptp_header hdr; struct Timestamp originTimestamp; + uint8_t suffix[0]; } PACKED; struct delay_req_msg { @@ -149,12 +150,14 @@ struct pdelay_req_msg { struct ptp_header hdr; struct Timestamp originTimestamp; struct PortIdentity reserved; + uint8_t suffix[0]; } PACKED; struct pdelay_resp_msg { struct ptp_header hdr; struct Timestamp requestReceiptTimestamp; struct PortIdentity requestingPortIdentity; + uint8_t suffix[0]; } PACKED; struct pdelay_resp_fup_msg { -- 1.9.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel