diff --git a/configs/config.example.yml b/configs/config.example.yml index 7609de15..0ac084d6 100644 --- a/configs/config.example.yml +++ b/configs/config.example.yml @@ -225,6 +225,8 @@ protocols: legacyGroupReg: false # Flag indicating the host should send a network grant demand TDU for conventional traffic. convNetGrantDemand: false + # Flag indicating the host should demand a full unit registration for a refused affiliation request. + demandUnitRegForRefusedAff: true # Flag indicating the host should verify group affiliation. verifyAff: false # Flag indicating the host should verify unit registration. diff --git a/src/host/p25/Control.cpp b/src/host/p25/Control.cpp index 4efa443f..d55b9996 100644 --- a/src/host/p25/Control.cpp +++ b/src/host/p25/Control.cpp @@ -5,7 +5,7 @@ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright (C) 2016,2017,2018 Jonathan Naylor, G4KLX - * Copyright (C) 2017-2024 Bryan Biedenkapp, N2PLL + * Copyright (C) 2017-2025 Bryan Biedenkapp, N2PLL * */ #include "Defines.h" @@ -78,6 +78,7 @@ Control::Control(bool authoritative, uint32_t nac, uint32_t callHang, uint32_t q m_convNetGrantDemand(false), m_sndcpSupport(false), m_ignoreAffiliationCheck(false), + m_demandUnitRegForRefusedAff(true), m_idenTable(idenTable), m_ridLookup(ridLookup), m_tidLookup(tidLookup), @@ -267,6 +268,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw m_sndcpSupport = p25Protocol["sndcpSupport"].as(false); m_ignoreAffiliationCheck = p25Protocol["ignoreAffiliationCheck"].as(false); + m_demandUnitRegForRefusedAff = p25Protocol["demandUnitRegForRefusedAff"].as(true); yaml::Node control = p25Protocol["control"]; m_enableControl = control["enable"].as(false); @@ -488,6 +490,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw LogInfo(" Unit-to-Unit Availability Check: %s", m_control->m_unitToUnitAvailCheck ? "yes" : "no"); LogInfo(" Explicit Source ID Support: %s", m_allowExplicitSourceId ? "yes" : "no"); LogInfo(" Conventional Network Grant Demand: %s", m_convNetGrantDemand ? "yes" : "no"); + LogInfo(" Demand Unit Registration for Refused Affiliation: %s", m_demandUnitRegForRefusedAff ? "yes" : "no"); if (disableUnitRegTimeout) { LogInfo(" Disable Unit Registration Timeout: yes"); diff --git a/src/host/p25/Control.h b/src/host/p25/Control.h index f81ead09..59cccbe2 100644 --- a/src/host/p25/Control.h +++ b/src/host/p25/Control.h @@ -5,7 +5,7 @@ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright (C) 2016,2017 Jonathan Naylor, G4KLX - * Copyright (C) 2017-2024 Bryan Biedenkapp, N2PLL + * Copyright (C) 2017-2025 Bryan Biedenkapp, N2PLL * */ /** @@ -308,6 +308,7 @@ namespace p25 bool m_convNetGrantDemand; bool m_sndcpSupport; bool m_ignoreAffiliationCheck; + bool m_demandUnitRegForRefusedAff; ::lookups::IdenTableLookup* m_idenTable; ::lookups::RadioIdLookup* m_ridLookup; diff --git a/src/host/p25/packet/ControlSignaling.cpp b/src/host/p25/packet/ControlSignaling.cpp index 80947a0e..1e9f36f2 100644 --- a/src/host/p25/packet/ControlSignaling.cpp +++ b/src/host/p25/packet/ControlSignaling.cpp @@ -4,7 +4,7 @@ * GPLv2 Open Source. Use is subject to license terms. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright (C) 2017-2024 Bryan Biedenkapp, N2PLL + * Copyright (C) 2017-2025 Bryan Biedenkapp, N2PLL * Copyright (C) 2022 Jason-UWU * */ @@ -540,7 +540,11 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptrm_demandUnitRegForRefusedAff) { + writeRF_TSDU_U_Reg_Cmd(srcId); + } + } } break; case TSBKO::ISP_GRP_AFF_Q_RSP: @@ -2637,10 +2641,8 @@ void ControlSignaling::writeRF_TSDU_Deny(uint32_t srcId, uint32_t dstId, uint8_t /* Helper to write a group affiliation response packet. */ -bool ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstId) +uint8_t ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstId) { - bool ret = false; - std::unique_ptr iosp = std::make_unique(); iosp->setMFId(m_lastMFID); iosp->setAnnounceGroup(m_announcementGroup); @@ -2714,7 +2716,6 @@ bool ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstId) } ::ActivityLog("P25", true, "group affiliation request from %u to %s %u", srcId, "TG ", dstId); - ret = true; // update dynamic affiliation table m_p25->m_affiliations.groupAff(srcId, dstId); @@ -2724,7 +2725,7 @@ bool ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstId) } writeRF_TSDU_SBF_Imm(iosp.get(), noNet); - return ret; + return iosp->getResponse(); } /* Helper to write a unit registration response packet. */ diff --git a/src/host/p25/packet/ControlSignaling.h b/src/host/p25/packet/ControlSignaling.h index 62815caa..ce19d6ca 100644 --- a/src/host/p25/packet/ControlSignaling.h +++ b/src/host/p25/packet/ControlSignaling.h @@ -4,7 +4,7 @@ * GPLv2 Open Source. Use is subject to license terms. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright (C) 2017-2024 Bryan Biedenkapp, N2PLL + * Copyright (C) 2017-2025 Bryan Biedenkapp, N2PLL * */ /** @@ -364,8 +364,9 @@ namespace p25 * @brief Helper to write a group affiliation response packet. * @param srcId Source Radio ID. * @param dstId Destination ID. + * @returns uint8_t Grant response code. */ - bool writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstId); + uint8_t writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstId); /** * @brief Helper to write a unit registration response packet. * @param srcId Source Radio ID. diff --git a/src/host/p25/packet/Voice.cpp b/src/host/p25/packet/Voice.cpp index 56f763ff..c1bba2d3 100644 --- a/src/host/p25/packet/Voice.cpp +++ b/src/host/p25/packet/Voice.cpp @@ -409,7 +409,7 @@ bool Voice::process(uint8_t* data, uint32_t len) // are we auto-registering legacy radios to groups? if (m_p25->m_legacyGroupReg && group) { if (!m_p25->m_affiliations.isGroupAff(srcId, dstId)) { - if (!m_p25->m_control->writeRF_TSDU_Grp_Aff_Rsp(srcId, dstId)) { + if (m_p25->m_control->writeRF_TSDU_Grp_Aff_Rsp(srcId, dstId) != ResponseCode::ACCEPT) { LogWarning(LOG_RF, P25_HDU_STR " denial, conventional affiliation required, not affiliated to TGID, srcId = %u, dstId = %u", srcId, dstId); m_p25->m_rfLastDstId = 0U; m_p25->m_rfLastSrcId = 0U;