diff --git a/configs/config.example.yml b/configs/config.example.yml index 4355e1e2..581d5ad8 100644 --- a/configs/config.example.yml +++ b/configs/config.example.yml @@ -17,6 +17,8 @@ daemon: true # 6 - Fatal # log: + # Flag indicating whether or not the NON-AUTHORITATIVE errors should be logged. + disableNonAuthoritiveLogging: false # Console display logging level (used when in foreground). displayLevel: 1 # File logging level. diff --git a/src/host/Host.cpp b/src/host/Host.cpp index 0e621559..e894995b 100644 --- a/src/host/Host.cpp +++ b/src/host/Host.cpp @@ -185,6 +185,7 @@ int Host::run() // initialize system logging yaml::Node logConf = m_conf["log"]; bool useSyslog = logConf["useSyslog"].as(false); + g_disableNonAuthoritativeLogging = logConf["disableNonAuthoritiveLogging"].as(false); if (g_foreground) useSyslog = false; ret = ::LogInitialise(logConf["filePath"].as(), logConf["fileRoot"].as(), diff --git a/src/host/HostMain.cpp b/src/host/HostMain.cpp index 84ccd6cc..b9fefec5 100644 --- a/src/host/HostMain.cpp +++ b/src/host/HostMain.cpp @@ -58,6 +58,8 @@ bool g_fireCCVCNotification = false; uint8_t* g_gitHashBytes = nullptr; +bool g_disableNonAuthoritativeLogging = false; + bool g_modemDebug = false; // --------------------------------------------------------------------------- diff --git a/src/host/HostMain.h b/src/host/HostMain.h index 1ff964bd..4755ea34 100644 --- a/src/host/HostMain.h +++ b/src/host/HostMain.h @@ -62,6 +62,9 @@ extern bool g_fireCCVCNotification; /** @brief */ extern uint8_t* g_gitHashBytes; +/** @brief (Global) Flag disabling NON-AUTHORITATIVE error logging. */ +extern bool g_disableNonAuthoritativeLogging; + /** @brief (Global) Modem debug flag. Forces modem debug regardless of configuration settings. */ extern bool g_modemDebug; diff --git a/src/host/dmr/Slot.cpp b/src/host/dmr/Slot.cpp index b586ccb2..3f0d2b41 100644 --- a/src/host/dmr/Slot.cpp +++ b/src/host/dmr/Slot.cpp @@ -21,6 +21,7 @@ #include "common/dmr/acl/AccessControl.h" #include "remote/RESTClient.h" #include "ActivityLog.h" +#include "HostMain.h" using namespace dmr; using namespace dmr::defines; @@ -414,7 +415,8 @@ void Slot::processNetwork(const data::NetData& dmrData) // 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); + if (!g_disableNonAuthoritativeLogging) + LogWarning(LOG_NET, "DMR Slot %u, [NON-AUTHORITATIVE] Ignoring network traffic, destination not permitted!", m_slotNo); return; } diff --git a/src/host/dmr/packet/ControlSignaling.cpp b/src/host/dmr/packet/ControlSignaling.cpp index 5ce8b55c..e4077c7d 100644 --- a/src/host/dmr/packet/ControlSignaling.cpp +++ b/src/host/dmr/packet/ControlSignaling.cpp @@ -857,6 +857,15 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_ ::lookups::TalkgroupRuleGroupVoice groupVoice = m_tscc->m_tidLookup->find(dstId); slot = groupVoice.source().tgSlot(); + // is this an affiliation required group? + ::lookups::TalkgroupRuleGroupVoice tid = m_tscc->m_tidLookup->find(dstId, slot); + if (tid.config().affiliated()) { + if (!m_tscc->m_affiliations->hasGroupAff(dstId)) { + LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, GRP_VOICE_CALL (Group Voice Call) ignored, no group affiliations, dstId = %u", m_tscc->m_slotNo, dstId); + return false; + } + } + uint32_t availChNo = m_tscc->m_affiliations->getAvailableChannelForSlot(slot); if (!m_tscc->m_affiliations->rfCh()->isRFChAvailable() || availChNo == 0U) { if (grp) { diff --git a/src/host/dmr/packet/Data.cpp b/src/host/dmr/packet/Data.cpp index 6827c3bb..cc00837b 100644 --- a/src/host/dmr/packet/Data.cpp +++ b/src/host/dmr/packet/Data.cpp @@ -22,6 +22,7 @@ #include "dmr/packet/Data.h" #include "dmr/Slot.h" #include "ActivityLog.h" +#include "HostMain.h" using namespace dmr; using namespace dmr::defines; @@ -36,7 +37,8 @@ using namespace dmr::packet; #define CHECK_AUTHORITATIVE(_DST_ID) \ if (!m_slot->m_authoritative && m_slot->m_permittedDstId != dstId) { \ - LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); \ + if (!g_disableNonAuthoritativeLogging) \ + LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); \ m_slot->m_rfState = RS_RF_LISTENING; \ return false; \ } diff --git a/src/host/dmr/packet/Voice.cpp b/src/host/dmr/packet/Voice.cpp index 66cd2106..224014b9 100644 --- a/src/host/dmr/packet/Voice.cpp +++ b/src/host/dmr/packet/Voice.cpp @@ -20,6 +20,7 @@ #include "dmr/packet/Voice.h" #include "dmr/Slot.h" #include "ActivityLog.h" +#include "HostMain.h" using namespace dmr; using namespace dmr::defines; @@ -34,7 +35,8 @@ using namespace dmr::packet; #define CHECK_AUTHORITATIVE(_DST_ID) \ if (!m_slot->m_authoritative && m_slot->m_permittedDstId != _DST_ID) { \ - LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted, dstId = %u", _DST_ID); \ + if (!g_disableNonAuthoritativeLogging) \ + LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted, dstId = %u", _DST_ID); \ m_slot->m_rfState = RS_RF_LISTENING; \ return false; \ } diff --git a/src/host/nxdn/packet/ControlSignaling.cpp b/src/host/nxdn/packet/ControlSignaling.cpp index e313d116..66d8a40b 100644 --- a/src/host/nxdn/packet/ControlSignaling.cpp +++ b/src/host/nxdn/packet/ControlSignaling.cpp @@ -468,6 +468,15 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId, uin } if (!m_nxdn->m_affiliations.isGranted(dstId)) { + // is this an affiliation required group? + ::lookups::TalkgroupRuleGroupVoice tid = m_nxdn->m_tidLookup->find(dstId); + if (tid.config().affiliated()) { + if (!m_nxdn->m_affiliations.hasGroupAff(dstId)) { + LogWarning(LOG_RF, "NXDN, %s ignored, no group affiliations, dstId = %u", rcch->toString().c_str(), dstId); + return false; + } + } + if (!m_nxdn->m_affiliations.rfCh()->isRFChAvailable()) { if (grp) { if (!net) { diff --git a/src/host/nxdn/packet/Voice.cpp b/src/host/nxdn/packet/Voice.cpp index 372b64ff..837ac4fa 100644 --- a/src/host/nxdn/packet/Voice.cpp +++ b/src/host/nxdn/packet/Voice.cpp @@ -18,6 +18,7 @@ #include "common/Log.h" #include "nxdn/packet/Voice.h" #include "ActivityLog.h" +#include "HostMain.h" using namespace nxdn; using namespace nxdn::defines; @@ -114,7 +115,8 @@ using namespace nxdn::packet; } \ \ if (!m_nxdn->m_authoritative && m_nxdn->m_permittedDstId != _DST_ID) { \ - LogWarning(LOG_NET, "[NON-AUTHORITATIVE] Ignoring network traffic, destination not permitted, dstId = %u", _DST_ID); \ + if (!g_disableNonAuthoritativeLogging) \ + LogWarning(LOG_NET, "[NON-AUTHORITATIVE] Ignoring network traffic, destination not permitted, dstId = %u", _DST_ID); \ resetNet(); \ if (m_nxdn->m_network != nullptr) \ m_nxdn->m_network->resetNXDN(); \ @@ -230,7 +232,8 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u // don't process RF frames if this modem isn't authoritative if (!m_nxdn->m_authoritative && m_nxdn->m_permittedDstId != dstId) { if (m_nxdn->m_rfState != RS_RF_AUDIO) { - LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); + if (!g_disableNonAuthoritativeLogging) + LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); m_nxdn->m_rfState = RS_RF_LISTENING; m_nxdn->m_rfMask = 0x00U; m_nxdn->m_rfLC.reset(); @@ -681,7 +684,8 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH& if (!m_nxdn->m_authoritative && m_nxdn->m_permittedDstId != dstId) { if (m_nxdn->m_netState != RS_NET_AUDIO) { // bryanb: do we want to log this condition? - //LogWarning(LOG_NET, "[NON-AUTHORITATIVE] Ignoring network traffic, destination not permitted!"); + //if (!g_disableNonAuthoritativeLogging) + // LogWarning(LOG_NET, "[NON-AUTHORITATIVE] Ignoring network traffic, destination not permitted!"); m_nxdn->m_netState = RS_NET_IDLE; m_nxdn->m_netMask = 0x00U; m_nxdn->m_netLC.reset(); diff --git a/src/host/p25/Control.cpp b/src/host/p25/Control.cpp index 502fc3b8..0cb7a7c9 100644 --- a/src/host/p25/Control.cpp +++ b/src/host/p25/Control.cpp @@ -1436,12 +1436,14 @@ void Control::processNetwork() } // perform grant response logic + m_control->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, !unitToUnit, true); +/* if (!m_control->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, !unitToUnit, true)) { - LogError(LOG_NET, P25_TSDU_STR " call failure, network call not granted, dstId = %u", dstId); + LogError(LOG_NET, P25_TSDU_STR " call rejected, network call not granted, dstId = %u", dstId); return; } - +*/ return; } diff --git a/src/host/p25/packet/ControlSignaling.cpp b/src/host/p25/packet/ControlSignaling.cpp index 32bc7975..73e1cfe6 100644 --- a/src/host/p25/packet/ControlSignaling.cpp +++ b/src/host/p25/packet/ControlSignaling.cpp @@ -2179,6 +2179,15 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_ } if (!m_p25->m_affiliations.isGranted(dstId)) { + // is this an affiliation required group? + ::lookups::TalkgroupRuleGroupVoice tid = m_p25->m_tidLookup->find(dstId); + if (tid.config().affiliated()) { + if (!m_p25->m_affiliations.hasGroupAff(dstId)) { + LogWarning(LOG_NET, P25_TSDU_STR ", TSBKO, IOSP_GRP_VCH (Group Voice Channel Request) ignored, no group affiliations, dstId = %u", dstId); + return false; + } + } + if (!m_p25->m_affiliations.rfCh()->isRFChAvailable()) { if (grp) { if (!net) { diff --git a/src/host/p25/packet/Voice.cpp b/src/host/p25/packet/Voice.cpp index 2f73fd07..2dd63ebe 100644 --- a/src/host/p25/packet/Voice.cpp +++ b/src/host/p25/packet/Voice.cpp @@ -21,6 +21,7 @@ #include "common/Utils.h" #include "p25/packet/Voice.h" #include "ActivityLog.h" +#include "HostMain.h" using namespace p25; using namespace p25::defines; @@ -134,7 +135,8 @@ bool Voice::process(uint8_t* data, uint32_t len) // don't process RF frames if this modem isn't authoritative if (!m_p25->m_authoritative && m_p25->m_permittedDstId != lc.getDstId()) { - LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); + if (!g_disableNonAuthoritativeLogging) + LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); resetRF(); m_p25->m_rfState = RS_RF_LISTENING; return false; @@ -220,7 +222,8 @@ bool Voice::process(uint8_t* data, uint32_t len) // don't process RF frames if this modem isn't authoritative if (!m_p25->m_authoritative && m_p25->m_permittedDstId != lc.getDstId()) { - LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); + if (!g_disableNonAuthoritativeLogging) + LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); resetRF(); m_p25->m_rfState = RS_RF_LISTENING; return false; @@ -587,7 +590,8 @@ bool Voice::process(uint8_t* data, uint32_t len) if (m_p25->m_rfState == RS_RF_AUDIO) { // don't process RF frames if this modem isn't authoritative if (!m_p25->m_authoritative && m_p25->m_permittedDstId != m_rfLC.getDstId()) { - LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); + if (!g_disableNonAuthoritativeLogging) + LogWarning(LOG_RF, "[NON-AUTHORITATIVE] Ignoring RF traffic, destination not permitted!"); resetRF(); m_p25->m_rfState = RS_RF_LISTENING; return false; @@ -1164,7 +1168,8 @@ bool Voice::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, data::L // 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, destination not permitted, dstId = %u", dstId); + if (!g_disableNonAuthoritativeLogging) + LogWarning(LOG_NET, "[NON-AUTHORITATIVE] Ignoring network traffic, destination not permitted, dstId = %u", dstId); resetNet(); if (m_p25->m_network != nullptr) m_p25->m_network->resetP25(); @@ -1678,7 +1683,7 @@ void Voice::writeNet_LDU1() (m_netLC.getPriority() & 0x07U); // Priority if (!m_p25->m_control->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, group, true)) { - LogError(LOG_NET, P25_HDU_STR " call failure, network call not granted, dstId = %u", dstId); + LogError(LOG_NET, P25_HDU_STR " call rejected, network call not granted, dstId = %u", dstId); if ((!m_p25->m_networkWatchdog.isRunning() || m_p25->m_networkWatchdog.hasExpired()) && m_p25->m_netLastDstId != 0U) { @@ -1929,7 +1934,8 @@ void Voice::writeNet_LDU2() // 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 (LDU2), destination not permitted!"); + if (!g_disableNonAuthoritativeLogging) + LogWarning(LOG_NET, "[NON-AUTHORITATIVE] Ignoring network traffic (LDU2), destination not permitted!"); resetNet(); return; }