prevent issue with 0 callDstId on dvmpatch; reject TDUs with no destination (these are invalid and can fuck off);

r05a04_dev
Bryan Biedenkapp 1 month ago
parent ef7ed5f57a
commit 40ef37179b

@ -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);

@ -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();

Loading…
Cancel
Save

Powered by TurnKey Linux.