diff --git a/src/fne/network/callhandler/TagP25Data.cpp b/src/fne/network/callhandler/TagP25Data.cpp index afdf7314..40a7f387 100644 --- a/src/fne/network/callhandler/TagP25Data.cpp +++ b/src/fne/network/callhandler/TagP25Data.cpp @@ -218,11 +218,17 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId if (duid != DUID::TSDU && duid != DUID::PDU) { // is this the end of the call stream? if ((duid == DUID::TDU) || (duid == DUID::TDULC)) { + // reject TDU with no source or destination if (srcId == 0U && dstId == 0U) { LogWarning(LOG_NET, "P25, invalid TDU, peer = %u, ssrc = %u, srcId = %u, dstId = %u, streamId = %u, fromUpstream = %u", peerId, ssrc, srcId, dstId, streamId, fromUpstream); return false; } + // reject TDU's with no destination + if (dstId == 0U) { + return false; + } + RxStatus status = m_status[dstId]; uint64_t duration = hrc::diff(pktTime, status.callStartTime); diff --git a/src/patch/HostPatch.cpp b/src/patch/HostPatch.cpp index 53e89a46..beb1de8c 100644 --- a/src/patch/HostPatch.cpp +++ b/src/patch/HostPatch.cpp @@ -1635,6 +1635,28 @@ void HostPatch::resetP25Call(uint32_t srcId) using namespace p25::defines; using namespace p25::dfsi::defines; + if (m_callDstId == 0U) { + LogWarning(LOG_HOST, "P25, resetP25Call(), callDstId is zero, cannot send TDU"); + + m_rxStartTime = 0U; + m_rxStreamId = 0U; + + m_callInProgress = false; + m_callAlgoId = ALGO_UNENCRYPT; + m_rxStartTime = 0U; + m_rxStreamId = 0U; + + m_p25SrcCrypto->clearMI(); + m_p25SrcCrypto->resetKeystream(); + m_p25DstCrypto->clearMI(); + m_p25DstCrypto->resetKeystream(); + + m_callDropTime.stop(); + + m_network->resetP25(); + return; + } + p25::lc::LC lc = p25::lc::LC(); lc.setLCO(P25DEF::LCO::GROUP); lc.setDstId(m_callDstId); @@ -1670,6 +1692,8 @@ void HostPatch::resetP25Call(uint32_t srcId) m_rxStartTime = 0U; m_rxStreamId = 0U; + m_callDstId = 0U; + m_p25SrcCrypto->clearMI(); m_p25SrcCrypto->resetKeystream(); m_p25DstCrypto->clearMI();