diff options
author | andrew-elder <aelder@audioscience.com> | 2016-03-15 09:42:04 -0400 |
---|---|---|
committer | andrew-elder <aelder@audioscience.com> | 2016-03-15 09:42:04 -0400 |
commit | 54a436b22aa038c848e7aa1ccec43ab0d6d8e154 (patch) | |
tree | fdc11cccf25862446797780e434b5db7559796c2 | |
parent | da8467834cb159c1a662ce81f0c291ab62b3192f (diff) | |
parent | 3f21a229a63f297ea6725cca5322c62bd15f9660 (diff) | |
download | Open-AVB-54a436b22aa038c848e7aa1ccec43ab0d6d8e154.tar.gz |
Merge pull request #357 from davidcemin/task-gptpv3
Adding more conditions to set ASCapable to false
-rw-r--r-- | daemons/gptp/common/ptp_message.cpp | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/daemons/gptp/common/ptp_message.cpp b/daemons/gptp/common/ptp_message.cpp index 01dcb49f..7476abae 100644 --- a/daemons/gptp/common/ptp_message.cpp +++ b/daemons/gptp/common/ptp_message.cpp @@ -1340,6 +1340,13 @@ void PTPMessagePathDelayRespFollowUp::processMessage(IEEE1588Port * port) PortIdentity req_id; PortIdentity resp_id; + PortIdentity fup_sourcePortIdentity; + PortIdentity resp_sourcePortIdentity; + ClockIdentity req_clkId; + ClockIdentity resp_clkId; + + uint16_t resp_port_number; + uint16_t req_port_number; if (req == NULL) { /* Shouldn't happen */ @@ -1358,6 +1365,12 @@ void PTPMessagePathDelayRespFollowUp::processMessage(IEEE1588Port * port) req->getPortIdentity(&req_id); 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); + resp->getPortIdentity(&resp_sourcePortIdentity); + getPortIdentity(&fup_sourcePortIdentity); if( req->getSequenceId() != sequenceId ) { XPTPD_ERROR @@ -1366,12 +1379,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"); @@ -1381,6 +1393,41 @@ 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 clock identity in the response is the same + * as this clock + */ + if (req_clkId != resp_clkId ) { + XPTPD_ERROR + ("ClockID Resp/Req differs. PDelay Response ClockID: %s PDelay Request ClockID: %s", + req_clkId.getIdentityString().c_str(), resp_clkId.getIdentityString().c_str() ); + 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 port number (%hu) is different from Response port number (%hu)", + resp_port_number, req_port_number); + + 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 sourcePortIdentity from PDelay Response and PDelay + * response Follow-UP (FUP) are the same. + */ + if ( fup_sourcePortIdentity != resp_sourcePortIdentity ) { + XPTPD_ERROR("Source port identity from PDelay Response/FUP differ"); + + goto abort; + } + port->getClock()->deleteEventTimerLocked (port, PDELAY_RESP_RECEIPT_TIMEOUT_EXPIRES); |