Skip to content

Commit

Permalink
fix override of packet sequence when it shouldn't; fix handling TDU f…
Browse files Browse the repository at this point in the history
…rom a specific source;
  • Loading branch information
gatekeep committed Jul 28, 2023
1 parent 54a2afc commit 0c40b2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
27 changes: 9 additions & 18 deletions src/network/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ void Network::clock(uint32_t ms)
uint32_t slotNo = (buffer[15U] & 0x80U) == 0x80U ? 2U : 1U;
if (m_rxDMRStreamId[slotNo] == 0U) {
m_rxDMRStreamId[slotNo] = streamId;
m_pktLastSeq = m_pktSeq;
}
else {
if (m_rxDMRStreamId[slotNo] == streamId) {
Expand All @@ -307,14 +308,10 @@ void Network::clock(uint32_t ms)
LogWarning(LOG_NET, "DMR Stream %u out-of-sequence; %u != %u", streamId, m_pktSeq, m_pktLastSeq + 1);
}
}

m_pktLastSeq = m_pktSeq;
}
/*
else {
m_rxDMRStreamId[slotNo] = streamId;
}
*/
}
m_pktLastSeq = m_pktSeq;

if (m_debug)
Utils::dump(1U, "Network Received, DMR", buffer.get(), length);
Expand All @@ -330,6 +327,7 @@ void Network::clock(uint32_t ms)
if (m_enabled && m_p25Enabled) {
if (m_rxP25StreamId == 0U) {
m_rxP25StreamId = streamId;
m_pktLastSeq = m_pktSeq;
}
else {
if (m_rxP25StreamId == streamId) {
Expand All @@ -338,14 +336,10 @@ void Network::clock(uint32_t ms)
LogWarning(LOG_NET, "P25 Stream %u out-of-sequence; %u != %u", streamId, m_pktSeq, m_pktLastSeq + 1);
}
}

m_pktLastSeq = m_pktSeq;
}
/*
else {
m_rxP25StreamId = streamId;
}
*/
}
m_pktLastSeq = m_pktSeq;

if (m_debug)
Utils::dump(1U, "Network Received, P25", buffer.get(), length);
Expand All @@ -361,6 +355,7 @@ void Network::clock(uint32_t ms)
if (m_enabled && m_nxdnEnabled) {
if (m_rxNXDNStreamId == 0U) {
m_rxNXDNStreamId = streamId;
m_pktLastSeq = m_pktSeq;
}
else {
if (m_rxNXDNStreamId == streamId) {
Expand All @@ -369,14 +364,10 @@ void Network::clock(uint32_t ms)
LogWarning(LOG_NET, "NXDN Stream %u out-of-sequence; %u != %u", streamId, m_pktSeq, m_pktLastSeq + 1);
}
}

m_pktLastSeq = m_pktSeq;
}
/*
else {
m_rxNXDNStreamId = streamId;
}
*/
}
m_pktLastSeq = m_pktSeq;

if (m_debug)
Utils::dump(1U, "Network Received, NXDN", buffer.get(), length);
Expand Down
6 changes: 5 additions & 1 deletion src/p25/packet/Voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,11 @@ bool Voice::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, data::L
break;
case P25_DUID_TDU:
case P25_DUID_TDULC:
// ignore a TDU that doesn't contain our destination ID
if (control.getDstId() != m_p25->m_netLastDstId) {
return false;
}

// don't process network frames if the RF modem isn't in a listening state
if (m_p25->m_rfState != RS_RF_LISTENING) {
resetNet();
Expand Down Expand Up @@ -1298,7 +1303,6 @@ void Voice::writeNet_LDU1()
control.setKId(m_netLastLDU1.getKId());
}


// restore MI from member variable
::memcpy(mi, m_lastMI, P25_MI_LENGTH_BYTES);

Expand Down

0 comments on commit 0c40b2b

Please sign in to comment.