allow DMR and P25 extended function responses to relay between FNE neighbors, upstream peers and consoles without site peer fanout, track P25 radio monitor requests as subscriber operations, and add regression coverage;

r05a06_dev
Bryan Biedenkapp 10 hours ago
parent 4e3a34182b
commit 365fc9fcc7

@ -257,6 +257,8 @@ const char* SubscriberOperationStore::kindName(Kind kind)
return "emerg-alrm";
case Kind::EMERG_CALL:
return "emerg-call";
case Kind::RADIO_MONITOR:
return "radio-monitor";
}
return "unknown";

@ -62,7 +62,9 @@ namespace network
KMM_CHANGERSI = 7U, //!< Key management change RSI request.
EMERG_ALRM = 8U, //!< Emergency alarm request.
EMERG_CALL = 9U //!< Emergency voice call.
EMERG_CALL = 9U, //!< Emergency voice call.
RADIO_MONITOR = 10U, //!< Radio monitor request.
};
/**

@ -145,6 +145,16 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
csbk = lc::csbk::CSBKFactory::createCSBK(frame, dataType);
}
// identify extended function request responses to restrict their routing
bool extendedFuncResponse = false;
if (csbk != nullptr && csbk->getCSBKO() == CSBKO::EXT_FNCT) {
lc::csbk::CSBK_EXT_FNCT* extendedFunction = static_cast<lc::csbk::CSBK_EXT_FNCT*>(csbk.get());
const uint8_t function = extendedFunction->getExtendedFunction();
extendedFuncResponse = function == ExtendedFunctions::CHECK_ACK ||
function == ExtendedFunctions::INHIBIT_ACK ||
function == ExtendedFunctions::UNINHIBIT_ACK;
}
std::unique_ptr<lc::LC> voiceLC;
if (dataSync && dataType == DataType::VOICE_LC_HEADER) {
lc::FullLC fullLC;
@ -158,7 +168,7 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
// is the stream valid?
if (validate(peerId, dmrData, csbk.get(), streamId)) {
// is this peer ignored?
if (!isPeerPermitted(peerId, dmrData, streamId, fromUpstream)) {
if (!extendedFuncResponse && !isPeerPermitted(peerId, dmrData, streamId, fromUpstream)) {
return false;
}
@ -626,13 +636,18 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
continue;
if (peerId != peer.first) {
TrafficNetwork::PeerConnectionPtr conn = peer.second;
if (extendedFuncResponse && conn->peerClass() != PEER_CONN_CLASS_NEIGHBOR &&
conn->peerClass() != PEER_CONN_CLASS_CONSOLE) {
continue;
}
if (ssrc == peer.first) {
// skip the peer if it is the source peer
continue;
}
// are we routing private calls?
if (m_network->m_privateCallRoutingEnabled) {
if (!extendedFuncResponse && m_network->m_privateCallRoutingEnabled) {
// is this peer an upstream neighbor peer?
bool neighbor = false;
if (conn != nullptr) {
@ -658,7 +673,7 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
}
// is this peer ignored?
if (!isPeerPermitted(peer.first, dmrData, streamId)) {
if (!extendedFuncResponse && !isPeerPermitted(peer.first, dmrData, streamId)) {
continue;
}
@ -687,7 +702,7 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
// if this is a private call, and we have already repeated to the connected peer that registered
// the unit, don't repeat to any neighbor FNE peers
if (privateCallInProgress && !noConnectedPeerRepeat) {
if (!extendedFuncResponse && privateCallInProgress && !noConnectedPeerRepeat) {
return true;
}
@ -714,7 +729,7 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
}
// is this peer ignored?
if (!isPeerPermitted(dstPeerId, dmrData, streamId, true)) {
if (!extendedFuncResponse && !isPeerPermitted(dstPeerId, dmrData, streamId, true)) {
continue;
}
@ -1143,27 +1158,27 @@ bool TagDMRData::processCSBK(uint8_t* buffer, uint32_t peerId, dmr::data::NetDat
case ExtendedFunctions::CHECK:
m_network->subscriberOperations().start(SubscriberOperationStore::Protocol::DMR,
SubscriberOperationStore::Kind::RADIO_CHECK, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::INHIBIT:
m_network->subscriberOperations().start(SubscriberOperationStore::Protocol::DMR,
SubscriberOperationStore::Kind::INHIBIT, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::UNINHIBIT:
m_network->subscriberOperations().start(SubscriberOperationStore::Protocol::DMR,
SubscriberOperationStore::Kind::UNINHIBIT, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::CHECK_ACK:
m_network->subscriberOperations().complete(SubscriberOperationStore::Protocol::DMR,
SubscriberOperationStore::Kind::RADIO_CHECK, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::INHIBIT_ACK:
m_network->subscriberOperations().complete(SubscriberOperationStore::Protocol::DMR,
SubscriberOperationStore::Kind::INHIBIT, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::UNINHIBIT_ACK:
m_network->subscriberOperations().complete(SubscriberOperationStore::Protocol::DMR,
SubscriberOperationStore::Kind::UNINHIBIT, iosp->getDstId(), peerId);
return false;
break;
}
}
break;

@ -190,6 +190,22 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
tsbk = lc::tsbk::TSBKFactory::createTSBK(data);
}
// identify extended function request responses to restrict their routing
bool extendedFuncResponse = false;
if (tsbk != nullptr && tsbk->getLCO() == TSBKO::IOSP_EXT_FNCT) {
lc::tsbk::IOSP_EXT_FNCT* extendedFunction = static_cast<lc::tsbk::IOSP_EXT_FNCT*>(tsbk.get());
if (extendedFunction != nullptr) {
const uint32_t function = extendedFunction->getExtendedFunction();
extendedFuncResponse = function == ExtendedFunctions::CHECK_ACK ||
function == ExtendedFunctions::INHIBIT_ACK ||
function == ExtendedFunctions::UNINHIBIT_ACK ||
function == ExtendedFunctions::DYN_REGRP_CANCEL_ACK ||
function == ExtendedFunctions::DYN_REGRP_LOCK_ACK ||
function == ExtendedFunctions::DYN_REGRP_REQ_ACK ||
function == ExtendedFunctions::DYN_REGRP_UNLOCK_ACK;
}
}
// decode true LDU LC from the network frame into a DFSI LC class literal
dfsi::LC dfsiLC = dfsi::LC(control, lsd);
if (duid == DUID::LDU1 || duid == DUID::LDU2) {
@ -757,6 +773,10 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
continue;
if (peerId != peer.first) {
TrafficNetwork::PeerConnectionPtr conn = peer.second;
if (extendedFuncResponse && conn->peerClass() != PEER_CONN_CLASS_NEIGHBOR && conn->peerClass() != PEER_CONN_CLASS_CONSOLE) {
continue;
}
if (ssrc == peer.first) {
// skip the peer if it is the source peer
continue;
@ -767,7 +787,7 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
continue;
}
if (m_network->m_privateCallRoutingEnabled) {
if (!extendedFuncResponse && m_network->m_privateCallRoutingEnabled) {
// is this peer an upstream neighbor peer?
bool neighbor = false;
if (conn != nullptr) {
@ -793,7 +813,7 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
}
// is this peer ignored?
if (!isPeerPermitted(peer.first, control, duid, streamId)) {
if (!extendedFuncResponse && !isPeerPermitted(peer.first, control, duid, streamId)) {
continue;
}
@ -834,7 +854,7 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
// if this is a private call, and we have already repeated to the connected peer that registered
// the unit, don't repeat to any neighbor FNE peers
if (privateCallInProgress && !noConnectedPeerRepeat) {
if (!extendedFuncResponse && privateCallInProgress && !noConnectedPeerRepeat) {
return true;
}
@ -873,7 +893,7 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
}
// is this peer ignored?
if (!isPeerPermitted(dstPeerId, control, duid, streamId, true)) {
if (!extendedFuncResponse && !isPeerPermitted(dstPeerId, control, duid, streamId, true)) {
continue;
}
@ -1485,27 +1505,27 @@ bool TagP25Data::processTSDUFrom(uint8_t* buffer, uint32_t peerId, uint8_t duid)
case ExtendedFunctions::CHECK:
m_network->subscriberOperations().start(SubscriberOperationStore::Protocol::P25,
SubscriberOperationStore::Kind::RADIO_CHECK, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::INHIBIT:
m_network->subscriberOperations().start(SubscriberOperationStore::Protocol::P25,
SubscriberOperationStore::Kind::INHIBIT, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::UNINHIBIT:
m_network->subscriberOperations().start(SubscriberOperationStore::Protocol::P25,
SubscriberOperationStore::Kind::UNINHIBIT, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::CHECK_ACK:
m_network->subscriberOperations().complete(SubscriberOperationStore::Protocol::P25,
SubscriberOperationStore::Kind::RADIO_CHECK, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::INHIBIT_ACK:
m_network->subscriberOperations().complete(SubscriberOperationStore::Protocol::P25,
SubscriberOperationStore::Kind::INHIBIT, iosp->getDstId(), peerId);
return false;
break;
case ExtendedFunctions::UNINHIBIT_ACK:
m_network->subscriberOperations().complete(SubscriberOperationStore::Protocol::P25,
SubscriberOperationStore::Kind::UNINHIBIT, iosp->getDstId(), peerId);
return false;
break;
}
}
break;
@ -1561,8 +1581,14 @@ bool TagP25Data::processTSDUFrom(uint8_t* buffer, uint32_t peerId, uint8_t duid)
break;
case TSBKO::IOSP_RAD_MON:
case TSBKO::IOSP_RAD_MON_ENH:
if (m_network->m_disallowRadioMonitor)
return false;
{
if (m_network->m_disallowRadioMonitor)
return false;
lc::tsbk::IOSP_RAD_MON* isp = static_cast<lc::tsbk::IOSP_RAD_MON*>(tsbk.get());
m_network->subscriberOperations().oneShot(SubscriberOperationStore::Protocol::P25,
SubscriberOperationStore::Kind::RADIO_MONITOR, isp->getSrcId(), peerId);
}
break;
default:
break;

@ -267,7 +267,7 @@ TEST_CASE("FNE metadata starts subscriber operations before transmission",
CHECK(operation.state == network::SubscriberOperationStore::State::PENDING);
}
TEST_CASE("FNE consumes radio-check responses without peer fanout",
TEST_CASE("FNE records radio-check responses and permits selective relay",
"[fne][subscriber-operations][routing]")
{
constexpr uint32_t SOURCE_PEER_ID = 1001U;
@ -291,11 +291,8 @@ TEST_CASE("FNE consumes radio-check responses without peer fanout",
network::SubscriberOperationStore::Kind::RADIO_CHECK, SUBSCRIBER_ID, SOURCE_PEER_ID);
REQUIRE(operationId != 0U);
std::vector<uint32_t> writes;
FNETestHooks::capturePeerWrites(harness.traffic, writes);
CHECK_FALSE(FNETestHooks::processRadioCheckResponse(
CHECK(FNETestHooks::processRadioCheckResponse(
harness.traffic, protocol, SOURCE_PEER_ID, SUBSCRIBER_ID));
CHECK(writes.empty());
network::SubscriberOperationStore::Operation operation;
REQUIRE(harness.traffic.subscriberOperations().get(operationId, operation));

@ -340,7 +340,7 @@ public:
* @param protocol DMR or P25 protocol handler to exercise.
* @param peerId Originating site peer ID.
* @param subscriberId Responding subscriber ID.
* @returns bool Protocol handler result; false indicates the response was consumed.
* @returns bool True when the response remains eligible for selective forwarding.
*/
static bool processRadioCheckResponse(network::TrafficNetwork& network,
ParrotProtocol protocol, uint32_t peerId, uint32_t subscriberId);

Loading…
Cancel
Save

Powered by TurnKey Linux.