diff options
author | David Cemin <david.cemin@coveloz.com> | 2016-03-14 15:30:47 -0400 |
---|---|---|
committer | David Cemin <david.cemin@coveloz.com> | 2016-03-14 15:30:47 -0400 |
commit | cf8b9ee882dd6356e3680e88c00f60495a55f561 (patch) | |
tree | cab2a0a435982911b6044fe180e1d557b80bbf7c | |
parent | bf8c7ce41f8371ef3ceb425ec9e672bc62a52590 (diff) | |
download | Open-AVB-cf8b9ee882dd6356e3680e88c00f60495a55f561.tar.gz |
Abort if recv portID differs from req portID
Another condition to leave the WAITING_FOR_PDELAY_RESP state is that the
requested port ID is the same as the response port ID. This commit fixes
this issue.
This patch fixes part B of gPTP 15.4, which is addressed by Issue #139
-rw-r--r-- | daemons/gptp/common/ptp_message.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/daemons/gptp/common/ptp_message.cpp b/daemons/gptp/common/ptp_message.cpp index 7fb75f01..684130d5 100644 --- a/daemons/gptp/common/ptp_message.cpp +++ b/daemons/gptp/common/ptp_message.cpp @@ -1343,6 +1343,9 @@ void PTPMessagePathDelayRespFollowUp::processMessage(IEEE1588Port * port) ClockIdentity req_clkId; ClockIdentity resp_clkId; + uint16_t resp_port_number; + uint16_t req_port_number; + if (req == NULL) { /* Shouldn't happen */ XPTPD_ERROR @@ -1362,6 +1365,8 @@ void PTPMessagePathDelayRespFollowUp::processMessage(IEEE1588Port * port) resp->getRequestingPortIdentity(&resp_id); req_clkId = req_id.getClockIdentity(); resp_clkId = resp_id.getClockIdentity(); + resp_id.getPortNumber(&resp_port_number); + requestingPortIdentity->getPortNumber(&req_port_number); if( req->getSequenceId() != sequenceId ) { XPTPD_ERROR @@ -1370,12 +1375,11 @@ void PTPMessagePathDelayRespFollowUp::processMessage(IEEE1588Port * port) goto abort; } + /* + * According to Figure 11-8 of subclause 11.2.15.3, a condition to leave the state + * WAITING_FOR_PDELAY_RESP is if the response seqID is the same as the requested. + */ if (resp->getSequenceId() != sequenceId) { - uint16_t resp_port_number; - uint16_t req_port_number; - resp_id.getPortNumber(&resp_port_number); - requestingPortIdentity->getPortNumber(&req_port_number); - XPTPD_ERROR ("Received PDelay Response Follow Up but cannot find " "corresponding response"); @@ -1397,6 +1401,18 @@ void PTPMessagePathDelayRespFollowUp::processMessage(IEEE1588Port * port) goto abort; } + /* + * According to Figure 11-8 of subclause 11.2.15.3, a condition to leave the state + * WAITING_FOR_PDELAY_RESP is if the response portID is the same as the requested. + */ + if ( resp_port_number != req_port_number ) { + XPTPD_ERROR + ("Request portID (%hu) is different from Response portID (%hu)", + resp_port_number, req_port_number); + + goto abort; + } + port->getClock()->deleteEventTimerLocked (port, PDELAY_RESP_RECEIPT_TIMEOUT_EXPIRES); |