From 81c16f6758e0282911aa748ce45dcb765064cc67 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Sat, 29 Apr 2023 12:46:17 -0400 Subject: [PATCH] add option to disable the source ID validation before issuing a grant; --- configs/config.example.yml | 6 ++++++ src/dmr/Control.cpp | 8 ++++++++ src/dmr/Slot.cpp | 1 + src/dmr/Slot.h | 4 ++++ src/dmr/packet/ControlSignaling.cpp | 25 +++++++++++++------------ src/nxdn/Control.cpp | 5 +++++ src/nxdn/packet/Trunk.cpp | 25 ++++++++++++++----------- src/nxdn/packet/Trunk.h | 2 ++ src/p25/Control.cpp | 5 +++++ src/p25/packet/Trunk.cpp | 25 ++++++++++++++----------- src/p25/packet/Trunk.h | 1 + 11 files changed, 73 insertions(+), 34 deletions(-) diff --git a/configs/config.example.yml b/configs/config.example.yml index 284b8023..44940022 100644 --- a/configs/config.example.yml +++ b/configs/config.example.yml @@ -100,6 +100,8 @@ protocols: enable: false # DMR slot number to transmit TSCC data on. slot: 1 + # Flag indicating whether or not the source ID validation before granting disabled. + disableGrantSourceIdCheck: false # Flag indicating whether or not received RF embedded LC data only should be transmitted. embeddedLCOnly: false @@ -161,6 +163,8 @@ protocols: disableTSDUMBF: false # Flag to enable optional TIME_DATE_ANNC TSBK during a CC broadcast. enableTimeDateAnn: false + # Flag indicating whether or not the source ID validation before granting disabled. + disableGrantSourceIdCheck: false # Flag indicating whether or not VOC (voice on control) support is enabled. voiceOnControl: false @@ -228,6 +232,8 @@ protocols: interval: 300 # Amount of time to transmit non-dedicated CC broadcasts. (seconds) duration: 1 + # Flag indicating whether or not the source ID validation before granting disabled. + disableGrantSourceIdCheck: false # Flag indicating whether or not VOC (voice on control) support is enabled. voiceOnControl: false diff --git a/src/dmr/Control.cpp b/src/dmr/Control.cpp index 5ec7f36f..9397e6d5 100644 --- a/src/dmr/Control.cpp +++ b/src/dmr/Control.cpp @@ -155,16 +155,20 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::vector(false); + if (enableTSCC) { m_tsccSlotNo = (uint8_t)control["slot"].as(0U); switch (m_tsccSlotNo) { case 1U: m_slot1->setTSCC(enableTSCC, dedicatedTSCC); m_slot1->setSupervisor(m_supervisor); + m_slot1->setDisableSourceIDGrantCheck(disableGrantSourceIdCheck); break; case 2U: m_slot2->setTSCC(enableTSCC, dedicatedTSCC); m_slot2->setSupervisor(m_supervisor); + m_slot2->setDisableSourceIDGrantCheck(disableGrantSourceIdCheck); break; default: LogError(LOG_DMR, "DMR, invalid slot, TSCC disabled, slotNo = %u", m_tsccSlotNo); @@ -173,6 +177,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::vector(dmr::DEFAULT_SILENCE_THRESHOLD); if (silenceThreshold > MAX_DMR_VOICE_ERRORS) { @@ -194,6 +199,9 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::vectorSets a flag indicating whether the slot has supervisory functions and can send permit TG to voice channels. void setSupervisor(bool supervisor) { m_supervisor = supervisor; } + /// Sets a flag indicating whether the slot has will perform source ID checks before issuing a grant. + void setDisableSourceIDGrantCheck(bool disableSourceIdGrant) { m_disableGrantSrcIdCheck = disableSourceIdGrant; } /// Helper to set the voice error silence threshold. void setSilenceThreshold(uint32_t threshold); @@ -196,6 +198,8 @@ namespace dmr bool m_tsccPayloadGroup; bool m_tsccPayloadVoice; + bool m_disableGrantSrcIdCheck; + uint32_t m_lastLateEntry; bool m_supervisor; diff --git a/src/dmr/packet/ControlSignaling.cpp b/src/dmr/packet/ControlSignaling.cpp index 968b3b36..22e8104f 100644 --- a/src/dmr/packet/ControlSignaling.cpp +++ b/src/dmr/packet/ControlSignaling.cpp @@ -867,22 +867,23 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_ } } else { - // do collision check between grants to see if a SU is attempting a "grant retry" or if this is a - // different source from the original grant - uint32_t grantedSrcId = m_tscc->m_affiliations->getGrantedSrcId(dstId); - if (srcId != grantedSrcId) { - if (!net) { - LogWarning(LOG_RF, "DMR Slot %u, DT_CSBK, CSBKO_RAND (Random Access), SVC_KIND_VOICE_CALL (Voice Call) denied, traffic in progress, dstId = %u", m_tscc->m_slotNo, dstId); - writeRF_CSBK_ACK_RSP(srcId, TS_DENY_RSN_TGT_BUSY, (grp) ? 1U : 0U); + if (!m_tscc->m_disableGrantSrcIdCheck) { + // do collision check between grants to see if a SU is attempting a "grant retry" or if this is a + // different source from the original grant + uint32_t grantedSrcId = m_tscc->m_affiliations->getGrantedSrcId(dstId); + if (srcId != grantedSrcId) { + if (!net) { + LogWarning(LOG_RF, "DMR Slot %u, DT_CSBK, CSBKO_RAND (Random Access), SVC_KIND_VOICE_CALL (Voice Call) denied, traffic in progress, dstId = %u", m_tscc->m_slotNo, dstId); + writeRF_CSBK_ACK_RSP(srcId, TS_DENY_RSN_TGT_BUSY, (grp) ? 1U : 0U); - ::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u denied", m_tscc->m_slotNo, srcId, dstId); - m_slot->m_rfState = RS_RF_REJECTED; - } + ::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u denied", m_tscc->m_slotNo, srcId, dstId); + m_slot->m_rfState = RS_RF_REJECTED; + } - return false; + return false; + } } - chNo = m_tscc->m_affiliations->getGrantedCh(dstId); slot = m_tscc->m_affiliations->getGrantedSlot(dstId); diff --git a/src/nxdn/Control.cpp b/src/nxdn/Control.cpp index 662807f2..ed74fab4 100644 --- a/src/nxdn/Control.cpp +++ b/src/nxdn/Control.cpp @@ -309,11 +309,16 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw } } + m_trunk->m_disableGrantSrcIdCheck = control["disableGrantSourceIdCheck"].as(false); + if (printOptions) { LogInfo(" Silence Threshold: %u (%.1f%%)", m_voice->m_silenceThreshold, float(m_voice->m_silenceThreshold) / 12.33F); if (m_control) { LogInfo(" Voice on Control: %s", m_voiceOnControl ? "yes" : "no"); + if (m_trunk->m_disableGrantSrcIdCheck) { + LogInfo(" Disable Grant Source ID Check: yes"); + } } LogInfo(" Verify Affiliation: %s", m_trunk->m_verifyAff ? "yes" : "no"); diff --git a/src/nxdn/packet/Trunk.cpp b/src/nxdn/packet/Trunk.cpp index 71793be9..389d2a29 100644 --- a/src/nxdn/packet/Trunk.cpp +++ b/src/nxdn/packet/Trunk.cpp @@ -318,6 +318,7 @@ Trunk::Trunk(Control* nxdn, network::BaseNetwork* network, bool debug, bool verb m_rcchIterateCnt(2U), m_verifyAff(false), m_verifyReg(false), + m_disableGrantSrcIdCheck(false), m_lastRejectId(0U), m_verbose(verbose), m_debug(debug) @@ -536,19 +537,21 @@ bool Trunk::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId, uint8_t servic } } else { - // do collision check between grants to see if a SU is attempting a "grant retry" or if this is a - // different source from the original grant - uint32_t grantedSrcId = m_nxdn->m_affiliations.getGrantedSrcId(dstId); - if (srcId != grantedSrcId) { - if (!net) { - LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL_REQ " denied, traffic in progress, dstId = %u", dstId); - writeRF_Message_Deny(0U, srcId, NXDN_CAUSE_VD_QUE_GRP_BUSY, RTCH_MESSAGE_TYPE_VCALL); + if (!m_disableGrantSrcIdCheck) { + // do collision check between grants to see if a SU is attempting a "grant retry" or if this is a + // different source from the original grant + uint32_t grantedSrcId = m_nxdn->m_affiliations.getGrantedSrcId(dstId); + if (srcId != grantedSrcId) { + if (!net) { + LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL_REQ " denied, traffic in progress, dstId = %u", dstId); + writeRF_Message_Deny(0U, srcId, NXDN_CAUSE_VD_QUE_GRP_BUSY, RTCH_MESSAGE_TYPE_VCALL); - ::ActivityLog("NXDN", true, "group grant request from %u to TG %u denied", srcId, dstId); - m_nxdn->m_rfState = RS_RF_REJECTED; - } + ::ActivityLog("NXDN", true, "group grant request from %u to TG %u denied", srcId, dstId); + m_nxdn->m_rfState = RS_RF_REJECTED; + } - return false; + return false; + } } chNo = m_nxdn->m_affiliations.getGrantedCh(dstId); diff --git a/src/nxdn/packet/Trunk.h b/src/nxdn/packet/Trunk.h index ae0193b9..4964d2a7 100644 --- a/src/nxdn/packet/Trunk.h +++ b/src/nxdn/packet/Trunk.h @@ -82,6 +82,8 @@ namespace nxdn bool m_verifyAff; bool m_verifyReg; + bool m_disableGrantSrcIdCheck; + uint16_t m_lastRejectId; bool m_verbose; diff --git a/src/p25/Control.cpp b/src/p25/Control.cpp index 0ed81b18..931a3922 100644 --- a/src/p25/Control.cpp +++ b/src/p25/Control.cpp @@ -345,12 +345,17 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw uint32_t ccBcstInterval = p25Protocol["control"]["interval"].as(300U); m_trunk->m_adjSiteUpdateInterval += ccBcstInterval; + m_trunk->m_disableGrantSrcIdCheck = p25Protocol["control"]["disableGrantSourceIdCheck"].as(false); + if (printOptions) { LogInfo(" Silence Threshold: %u (%.1f%%)", m_voice->m_silenceThreshold, float(m_voice->m_silenceThreshold) / 12.33F); if (m_control) { LogInfo(" Voice on Control: %s", m_voiceOnControl ? "yes" : "no"); LogInfo(" Ack Requests: %s", m_ackTSBKRequests ? "yes" : "no"); + if (m_trunk->m_disableGrantSrcIdCheck) { + LogInfo(" Disable Grant Source ID Check: yes"); + } } LogInfo(" Disable Network HDUs: %s", m_disableNetworkHDU ? "yes" : "no"); diff --git a/src/p25/packet/Trunk.cpp b/src/p25/packet/Trunk.cpp index e1bf6f35..33285f46 100644 --- a/src/p25/packet/Trunk.cpp +++ b/src/p25/packet/Trunk.cpp @@ -1217,6 +1217,7 @@ Trunk::Trunk(Control* p25, network::BaseNetwork* network, bool dumpTSBKData, boo m_ctrlTimeDateAnn(false), m_ctrlTSDUMBF(true), m_sndcpChGrant(false), + m_disableGrantSrcIdCheck(false), m_dumpTSBK(dumpTSBKData), m_verbose(verbose), m_debug(debug) @@ -2227,19 +2228,21 @@ bool Trunk::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_t serviceOp } } else { - // do collision check between grants to see if a SU is attempting a "grant retry" or if this is a - // different source from the original grant - uint32_t grantedSrcId = m_p25->m_affiliations.getGrantedSrcId(dstId); - if (srcId != grantedSrcId) { - if (!net) { - LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic in progress, dstId = %u", dstId); - writeRF_TSDU_Deny(srcId, dstId, P25_DENY_RSN_PTT_COLLIDE, (grp) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH); + if (!m_disableGrantSrcIdCheck) { + // do collision check between grants to see if a SU is attempting a "grant retry" or if this is a + // different source from the original grant + uint32_t grantedSrcId = m_p25->m_affiliations.getGrantedSrcId(dstId); + if (srcId != grantedSrcId) { + if (!net) { + LogWarning(LOG_RF, P25_TSDU_STR ", TSBK_IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic in progress, dstId = %u", dstId); + writeRF_TSDU_Deny(srcId, dstId, P25_DENY_RSN_PTT_COLLIDE, (grp) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH); - ::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId); - m_p25->m_rfState = RS_RF_REJECTED; - } + ::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId); + m_p25->m_rfState = RS_RF_REJECTED; + } - return false; + return false; + } } chNo = m_p25->m_affiliations.getGrantedCh(dstId); diff --git a/src/p25/packet/Trunk.h b/src/p25/packet/Trunk.h index d0f55d6c..1d8a0068 100644 --- a/src/p25/packet/Trunk.h +++ b/src/p25/packet/Trunk.h @@ -150,6 +150,7 @@ namespace p25 bool m_ctrlTSDUMBF; bool m_sndcpChGrant; + bool m_disableGrantSrcIdCheck; bool m_dumpTSBK;