refactor TG hang to only apply to authoritative voice channels; correct handling of non-authoritative permitted destination IDs for NXDN and DMR; move non-authoratative handling into main processNetwork() for P25;

pull/39/head
Bryan Biedenkapp 3 years ago
parent bed079f68e
commit e94964ea2f

@ -349,7 +349,7 @@ void Slot::processNetwork(const data::Data& dmrData)
{
// don't process network frames if the RF modem isn't in a listening state
if (m_rfState != RS_RF_LISTENING) {
LogWarning(LOG_NET, "Traffic collision detect, preempting new network traffic to existing RF traffic!");
LogWarning(LOG_NET, "DMR Slot %u, Traffic collision detect, preempting new network traffic to existing RF traffic!", m_slotNo);
return;
}
@ -364,6 +364,7 @@ void Slot::processNetwork(const data::Data& dmrData)
}
}
if (m_authoritative) {
// don't process network frames if the destination ID's don't match and the network TG hang timer is running
if (m_netLastDstId != 0U && dmrData.getDstId() != 0U && m_netState != RS_NET_IDLE) {
if (m_netLastDstId != dmrData.getDstId() && (m_netTGHang.isRunning() && !m_netTGHang.hasExpired())) {
@ -374,6 +375,13 @@ void Slot::processNetwork(const data::Data& dmrData)
m_netTGHang.start();
}
}
}
// don't process network frames if this modem isn't authoritative
if (!m_authoritative && m_permittedDstId != dmrData.getDstId()) {
LogWarning(LOG_NET, "DMR Slot %u, [NON-AUTHORITATIVE] Ignoring network traffic, destination not permitted!", m_slotNo);
return;
}
m_networkWatchdog.start();
@ -526,6 +534,7 @@ void Slot::clock()
}
}
if (m_authoritative) {
if (m_netTGHang.isRunning()) {
m_netTGHang.clock(ms);
@ -538,6 +547,10 @@ void Slot::clock()
m_netLastSrcId = 0U;
}
}
}
else {
m_netTGHang.stop();
}
if (m_netState == RS_NET_AUDIO || m_netState == RS_NET_DATA) {
m_networkWatchdog.clock(ms);

@ -604,6 +604,7 @@ void Control::clock(uint32_t ms)
}
}
if (m_authoritative) {
if (m_netTGHang.isRunning()) {
m_netTGHang.clock(ms);
@ -616,6 +617,10 @@ void Control::clock(uint32_t ms)
m_netLastSrcId = 0U;
}
}
}
else {
m_netTGHang.stop();
}
if (m_netState == RS_NET_AUDIO) {
m_networkWatchdog.clock(ms);

@ -94,6 +94,7 @@ using namespace nxdn::packet;
} \
} \
\
if (m_nxdn->m_authoritative) { \
if (m_nxdn->m_netLastDstId != 0U) { \
if (m_nxdn->m_netLastDstId != _DST_ID && (m_nxdn->m_netTGHang.isRunning() && !m_nxdn->m_netTGHang.hasExpired())) { \
return false; \
@ -121,6 +122,15 @@ using namespace nxdn::packet;
m_network->resetNXDN(); \
return false; \
} \
} \
} \
\
if (!m_nxdn->m_authoritative && m_nxdn->m_permittedDstId != dstId) { \
LogWarning(LOG_NET, "[NON-AUTHORITATIVE] Ignoring network traffic, destination not permitted!"); \
resetNet(); \
if (m_network != nullptr) \
m_network->resetNXDN(); \
return false; \
}
// Validate the source RID

@ -764,6 +764,7 @@ void Control::clock(uint32_t ms)
}
}
if (m_authoritative) {
if (m_netTGHang.isRunning()) {
m_netTGHang.clock(ms);
@ -776,6 +777,10 @@ void Control::clock(uint32_t ms)
m_netLastSrcId = 0U;
}
}
}
else {
m_netTGHang.stop();
}
if (m_netState == RS_NET_AUDIO || m_netState == RS_NET_DATA) {
m_networkWatchdog.clock(ms);

@ -799,6 +799,8 @@ bool Voice::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, data::L
}
}
// perform authoritative network TG hangtimer and traffic preemption
if (m_p25->m_authoritative) {
// don't process network frames if the destination ID's don't match and the network TG hang timer is running
if (m_p25->m_netLastDstId != 0U && dstId != 0U && (duid == P25_DUID_LDU1 || duid == P25_DUID_LDU2)) {
if (m_p25->m_netLastDstId != dstId && (m_p25->m_netTGHang.isRunning() && !m_p25->m_netTGHang.hasExpired())) {
@ -829,6 +831,16 @@ bool Voice::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, data::L
return false;
}
}
}
// don't process network frames if this modem isn't authoritative
if (!m_p25->m_authoritative && m_p25->m_permittedDstId != dstId) {
LogWarning(LOG_NET, "[NON-AUTHORITATIVE] Ignoring network traffic (LDU1), destination not permitted!");
resetNet();
if (m_network != nullptr)
m_network->resetP25();
return false;
}
uint32_t count = 0U;
switch (duid) {
@ -1239,13 +1251,6 @@ void Voice::writeNet_LDU1()
}
}
// don't process network frames if this modem isn't authoritative
if (!m_p25->m_authoritative && m_p25->m_permittedDstId != dstId) {
LogWarning(LOG_NET, "[NON-AUTHORITATIVE] Ignoring network traffic (LDU1), destination not permitted!");
resetNet();
return;
}
if (m_debug) {
LogMessage(LOG_NET, P25_LDU1_STR " service flags, emerg = %u, encrypt = %u, prio = %u, DFSI emerg = %u, DFSI encrypt = %u, DFSI prio = %u",
control.getEmergency(), control.getEncrypted(), control.getPriority(),

Loading…
Cancel
Save

Powered by TurnKey Linux.