Skip to content

Commit

Permalink
add disablePacketData flag to disable the FNE passing packet data;
Browse files Browse the repository at this point in the history
  • Loading branch information
gatekeep committed Jul 8, 2024
1 parent c9e7dcc commit 806f950
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions configs/fne-config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ master:
# Flag indicating whether or not NXDN traffic will be passed.
allowNXDNTraffic: true

# Flag indicating whether packet data will be passed.
disablePacketData: false
# Flag indicating whether verbose dumping of data packets is enabled.
dumpDataPacket: false

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 @@ -89,6 +89,7 @@ FNENetwork::FNENetwork(HostFNE* host, const std::string& address, uint16_t port,
m_influxOrg("dvm"),
m_influxBucket("dvm"),
m_influxLogRawData(false),
m_disablePacketData(false),
m_dumpDataPacket(false),
m_reportPeerPing(reportPeerPing),
m_verbose(verbose)
Expand Down Expand Up @@ -147,6 +148,7 @@ void FNENetwork::setOptions(yaml::Node& conf, bool printOptions)
m_filterHeaders = conf["filterHeaders"].as<bool>(true);
m_filterTerminators = conf["filterTerminators"].as<bool>(true);

m_disablePacketData = conf["disablePacketData"].as<bool>(false);
m_dumpDataPacket = conf["dumpDataPacket"].as<bool>(false);

/*
Expand All @@ -169,6 +171,7 @@ void FNENetwork::setOptions(yaml::Node& conf, bool printOptions)
if (m_disallowAdjStsBcast) {
LogWarning(LOG_NET, "NOTICE: All P25 ADJ_STS_BCAST messages will be blocked and dropped!");
}
LogInfo(" Disable Packet Data: %s", m_disablePacketData ? "yes" : "no");
LogInfo(" Dump Packet Data: %s", m_dumpDataPacket ? "yes" : "no");
LogInfo(" Disable P25 ADJ_STS_BCAST to external peers: %s", m_disallowExtAdjStsBcast ? "yes" : "no");
LogInfo(" Allow conventional sites to override affiliation and receive all traffic: %s", m_allowConvSiteAffOverride ? "yes" : "no");
Expand Down
2 changes: 2 additions & 0 deletions src/fne/network/FNENetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ namespace network
bool m_influxLogRawData;
influxdb::ServerInfo m_influxServer;

bool m_disablePacketData;
bool m_dumpDataPacket;

bool m_reportPeerPing;
bool m_verbose;

Expand Down
8 changes: 8 additions & 0 deletions src/fne/network/callhandler/TagDMRData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
dmrData.setN(n);
}

if (dataType == DataType::DATA_HEADER ||
dataType == DataType::RATE_12_DATA ||
dataType == DataType::RATE_34_DATA ||
dataType == DataType::RATE_1_DATA) {
if (m_network->m_disablePacketData)
return false;
}

// perform TGID route rewrites if configured
routeRewrite(buffer, peerId, dmrData, dataType, dstId, slotNo, false);
dstId = __GET_UINT16(buffer, 8U);
Expand Down
6 changes: 6 additions & 0 deletions src/fne/network/callhandler/TagNXDNData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI
uint32_t srcId = __GET_UINT16(data, 5U);
uint32_t dstId = __GET_UINT16(data, 8U);

if (messageType == MessageType::RTCH_DCALL_HDR ||
messageType == MessageType::RTCH_DCALL_DATA) {
if (m_network->m_disablePacketData)
return false;
}

// perform TGID route rewrites if configured
routeRewrite(buffer, peerId, messageType, dstId, false);
dstId = __GET_UINT16(buffer, 8U);
Expand Down
2 changes: 2 additions & 0 deletions src/fne/network/callhandler/TagP25Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
FrameType::E frameType = FrameType::DATA_UNIT;

if (duid == DUID::PDU) {
if (m_network->m_disablePacketData)
return false;
return m_packetData->processFrame(data, len, peerId, pktSeq, streamId, external);
}

Expand Down

0 comments on commit 806f950

Please sign in to comment.