Skip to content

Commit

Permalink
enhance TDULC CALL_TERM handling in dvmhost; allow dvmfne to optional…
Browse files Browse the repository at this point in the history
…ly drop TDULC CALL_TERMs or pass them;
  • Loading branch information
gatekeep committed Feb 9, 2025
1 parent 8c48c9b commit a4e8138
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions configs/fne-config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ master:
disallowExtAdjStsBcast: true
# Flag indicating whether or not a conventional site can override affiliation rules.
allowConvSiteAffOverride: true
# Flag indicating whether or not a TDULC call terminations will pass to any peers.
disallowCallTerm: false

# Flag indicating that traffic headers will be filtered by destination ID (i.e. valid RID or valid TGID).
filterHeaders: true
Expand Down
3 changes: 3 additions & 0 deletions src/fne/network/FNENetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ FNENetwork::FNENetwork(HostFNE* host, const std::string& address, uint16_t port,
m_disallowAdjStsBcast(false),
m_disallowExtAdjStsBcast(true),
m_allowConvSiteAffOverride(false),
m_disallowCallTerm(false),
m_restrictGrantToAffOnly(false),
m_filterHeaders(true),
m_filterTerminators(true),
Expand Down Expand Up @@ -126,6 +127,7 @@ void FNENetwork::setOptions(yaml::Node& conf, bool printOptions)
m_disallowAdjStsBcast = conf["disallowAdjStsBcast"].as<bool>(false);
m_disallowExtAdjStsBcast = conf["disallowExtAdjStsBcast"].as<bool>(true);
m_allowConvSiteAffOverride = conf["allowConvSiteAffOverride"].as<bool>(true);
m_disallowCallTerm = conf["disallowCallTerm"].as<bool>(false);
m_softConnLimit = conf["connectionLimit"].as<uint32_t>(MAX_HARD_CONN_CAP);

if (m_softConnLimit > MAX_HARD_CONN_CAP) {
Expand Down Expand Up @@ -183,6 +185,7 @@ void FNENetwork::setOptions(yaml::Node& conf, bool printOptions)
LogInfo(" Disable Packet Data: %s", m_disablePacketData ? "yes" : "no");
LogInfo(" Dump Packet Data: %s", m_dumpPacketData ? "yes" : "no");
LogInfo(" Disable P25 ADJ_STS_BCAST to external peers: %s", m_disallowExtAdjStsBcast ? "yes" : "no");
LogInfo(" Disable P25 TDULC call termination broadcasts to any peers: %s", m_disallowCallTerm ? "yes" : "no");
LogInfo(" Allow conventional sites to override affiliation and receive all traffic: %s", m_allowConvSiteAffOverride ? "yes" : "no");
LogInfo(" Restrict grant response by affiliation: %s", m_restrictGrantToAffOnly ? "yes" : "no");
LogInfo(" Traffic Headers Filtered by Destination ID: %s", m_filterHeaders ? "yes" : "no");
Expand Down
1 change: 1 addition & 0 deletions src/fne/network/FNENetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ namespace network
bool m_disallowAdjStsBcast;
bool m_disallowExtAdjStsBcast;
bool m_allowConvSiteAffOverride;
bool m_disallowCallTerm;
bool m_restrictGrantToAffOnly;

bool m_filterHeaders;
Expand Down
3 changes: 2 additions & 1 deletion src/fne/network/callhandler/TagP25Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,8 @@ bool TagP25Data::processTSDUFrom(uint8_t* buffer, uint32_t peerId, uint8_t duid)
// handle standard P25 reference opcodes
switch (tdulc->getLCO()) {
case LCO::CALL_TERM:
return false; // discard call terms at the FNE
if (m_network->m_disallowCallTerm)
return false;
default:
break;
}
Expand Down
17 changes: 13 additions & 4 deletions src/host/p25/packet/Voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -1358,6 +1358,18 @@ bool Voice::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, data::L
// currently ignored -- this is a TODO
break;
case DUID::TDU:
case DUID::TDULC:
if (duid == DUID::TDULC) {
std::unique_ptr<lc::TDULC> tdulc = lc::tdulc::TDULCFactory::createTDULC(data);
if (tdulc == nullptr) {
LogWarning(LOG_NET, P25_TDULC_STR ", undecodable TDULC");
}
else {
if (tdulc->getLCO() != LCO::CALL_TERM)
break;
}
}

// ignore a TDU that doesn't contain our destination ID
if (control.getDstId() != m_p25->m_netLastDstId) {
return false;
Expand All @@ -1384,9 +1396,6 @@ bool Voice::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, data::L
resetNet();
}
break;
case DUID::TDULC:
// currently ignored
break;

default:
break;
Expand Down

0 comments on commit a4e8138

Please sign in to comment.