allow configuration of the logging for RID ACL list, TGID ACL list, and FNE peer list;

pull/121/merge
Bryan Biedenkapp 1 week ago
parent a5bd449761
commit 739c8bbf85

@ -762,6 +762,8 @@ system:
time: 2
# Flag indicating whether or not RID ACLs are enforced.
acl: false
# Flag indicating whether or not the RID ACL updates are logged.
verbose: false
#
# Talkgroupd ID ACL Configuration
@ -775,3 +777,5 @@ system:
time: 2
# Flag indicating whether or not TGID ACLs are enforced.
acl: false
# Flag indicating whether or not the talkgroup rules updates are logged.
verbose: true

@ -240,6 +240,8 @@ master:
file: talkgroup_rules.yml
# Amount of time between updates of talkgroup rules file. (minutes)
time: 30
# Flag indicating whether or not the talkgroup rules updates are logged.
verbose: true
#
# Adj. Site Map Configuration
@ -345,6 +347,8 @@ system:
file: rid_acl.dat
# Amount of time between updates of Radio ID ACL file. (minutes)
time: 2
# Flag indicating whether or not the Radio ID ACL updates are logged.
verbose: false
#
# Peer ACL configuration
@ -356,6 +360,8 @@ system:
file: peer_list.dat
# Amount of time between updates of peer ACL file. (minutes)
time: 2
# Flag indicating whether or not the peer ACL updates are logged.
verbose: true
#
# Packet Data Virtual Network Tunnel Configuration

@ -50,8 +50,9 @@ bool PeerListLookup::s_locked = false;
/* Initializes a new instance of the PeerListLookup class. */
PeerListLookup::PeerListLookup(const std::string& filename, uint32_t reloadTime, bool peerAcl) : LookupTable(filename, reloadTime),
m_acl(peerAcl)
PeerListLookup::PeerListLookup(const std::string& filename, uint32_t reloadTime, bool peerAcl, bool verbose) : LookupTable(filename, reloadTime),
m_acl(peerAcl),
m_verbose(verbose)
{
/* stub */
}
@ -275,14 +276,16 @@ bool PeerListLookup::load()
m_table[id] = entry;
// log depending on what was loaded
LogInfoEx(LOG_HOST, "Loaded peer ID %u%s into peer ID lookup table, %s%s%s%s%s%s", id,
(!alias.empty() ? (" (" + alias + ")").c_str() : ""),
(!password.empty() ? "using unique peer password" : "using master password"),
(peerReplica) ? ", Replication Enabled" : "",
(canRequestKeys) ? ", Can Request Keys" : "",
(canIssueInhibit) ? ", Can Issue Inhibit" : "",
(hasCallPriority) ? ", Has Call Priority" : "",
(jitterBufferEnabled) ? ", Jitter Buffer Enabled" : "");
if (m_verbose) {
LogInfoEx(LOG_HOST, "Loaded peer ID %u%s into peer ID lookup table, %s%s%s%s%s%s", id,
(!alias.empty() ? (" (" + alias + ")").c_str() : ""),
(!password.empty() ? "using unique peer password" : "using master password"),
(peerReplica) ? ", Replication Enabled" : "",
(canRequestKeys) ? ", Can Request Keys" : "",
(canIssueInhibit) ? ", Can Issue Inhibit" : "",
(hasCallPriority) ? ", Has Call Priority" : "",
(jitterBufferEnabled) ? ", Jitter Buffer Enabled" : "");
}
}
}

@ -212,8 +212,9 @@ namespace lookups
* @param filename Full-path to the list file.
* @param reloadTime Interval of time to reload the lookup table.
* @param peerAcl Flag indicating these rules are enabled for enforcing access control.
* @param verbose Flag indicating if logging should be enabled for this lookup table.
*/
PeerListLookup(const std::string& filename, uint32_t reloadTime, bool peerAcl);
PeerListLookup(const std::string& filename, uint32_t reloadTime, bool peerAcl, bool verbose = true);
/**
* @brief Clears all entries from the list.
@ -283,6 +284,8 @@ namespace lookups
protected:
bool m_acl;
bool m_verbose;
/**
* @brief Loads the table from the passed lookup table file.
* @return True, if lookup table was loaded, otherwise false.

@ -52,8 +52,9 @@ bool RadioIdLookup::s_locked = false;
/* Initializes a new instance of the RadioIdLookup class. */
RadioIdLookup::RadioIdLookup(const std::string& filename, uint32_t reloadTime, bool ridAcl) : LookupTable(filename, reloadTime),
m_acl(ridAcl)
RadioIdLookup::RadioIdLookup(const std::string& filename, uint32_t reloadTime, bool ridAcl, bool verbose) : LookupTable(filename, reloadTime),
m_acl(ridAcl),
m_verbose(verbose)
{
/* stub */
}
@ -223,7 +224,10 @@ bool RadioIdLookup::load()
}
m_table[id] = RadioId(radioEnabled, false, alias, ipAddress);
//::LogInfoEx(LOG_HOST, "Radio NAME: %s RID: %u ENABLED: %u IPADDR: %s", alias.c_str(), id, radioEnabled, ipAddress.c_str());
if (m_verbose) {
LogInfoEx(LOG_HOST, "Radio NAME: %s RID: %u ENABLED: %u IPADDR: %s", alias.c_str(), id, radioEnabled, ipAddress.c_str());
}
}
}

@ -147,8 +147,9 @@ namespace lookups
* @param filename Full-path to the radio ID table file.
* @param reloadTime Interval of time to reload the radio ID table.
* @param ridAcl Flag indicating whether radio ID access control is enabled.
* @param verbose Flag indicating if logging should be enabled for this lookup table.
*/
RadioIdLookup(const std::string& filename, uint32_t reloadTime, bool ridAcl);
RadioIdLookup(const std::string& filename, uint32_t reloadTime, bool ridAcl, bool verbose = false);
/**
* @brief Clears all entries from the lookup table.
@ -207,6 +208,8 @@ namespace lookups
protected:
bool m_acl;
bool m_verbose;
/**
* @brief Loads the table from the passed lookup table file.
* @return True, if lookup table was loaded, otherwise false.

@ -50,12 +50,13 @@ bool TalkgroupRulesLookup::s_locked = false;
/* Initializes a new instance of the TalkgroupRulesLookup class. */
TalkgroupRulesLookup::TalkgroupRulesLookup(const std::string& filename, uint32_t reloadTime, bool acl) : Thread(),
TalkgroupRulesLookup::TalkgroupRulesLookup(const std::string& filename, uint32_t reloadTime, bool acl, bool verbose) : Thread(),
m_rulesFile(filename),
m_reloadTime(reloadTime),
m_rules(),
m_lastLoadTime(0U),
m_acl(acl),
m_verbose(verbose),
m_stop(false),
m_groupHangTime(5U),
m_sendTalkgroups(false),
@ -345,29 +346,31 @@ bool TalkgroupRulesLookup::load()
TalkgroupRuleGroupVoice groupVoice = TalkgroupRuleGroupVoice(groupVoiceList[i]);
m_groupVoice.push_back(groupVoice);
std::string groupName = groupVoice.name();
uint32_t tgId = groupVoice.source().tgId();
uint8_t tgSlot = groupVoice.source().tgSlot();
bool active = groupVoice.config().active();
bool parrot = groupVoice.config().parrot();
bool affil = groupVoice.config().affiliated();
uint32_t incCount = groupVoice.config().inclusion().size();
uint32_t excCount = groupVoice.config().exclusion().size();
uint32_t rewrCount = groupVoice.config().rewrite().size();
uint32_t alwyCount = groupVoice.config().alwaysSend().size();
uint32_t prefCount = groupVoice.config().preferred().size();
uint32_t permRIDCount = groupVoice.config().permittedRIDs().size();
if (incCount > 0 && excCount > 0) {
::LogWarning(LOG_HOST, "Talkgroup (%s) defines both inclusions and exclusions! Inclusion rules take precedence and exclusion rules will be ignored.", groupName.c_str());
}
if (m_verbose) {
std::string groupName = groupVoice.name();
uint32_t tgId = groupVoice.source().tgId();
uint8_t tgSlot = groupVoice.source().tgSlot();
bool active = groupVoice.config().active();
bool parrot = groupVoice.config().parrot();
bool affil = groupVoice.config().affiliated();
uint32_t incCount = groupVoice.config().inclusion().size();
uint32_t excCount = groupVoice.config().exclusion().size();
uint32_t rewrCount = groupVoice.config().rewrite().size();
uint32_t alwyCount = groupVoice.config().alwaysSend().size();
uint32_t prefCount = groupVoice.config().preferred().size();
uint32_t permRIDCount = groupVoice.config().permittedRIDs().size();
if (incCount > 0 && excCount > 0) {
::LogWarning(LOG_HOST, "Talkgroup (%s) defines both inclusions and exclusions! Inclusion rules take precedence and exclusion rules will be ignored.", groupName.c_str());
}
if (alwyCount > 0 && affil) {
::LogWarning(LOG_HOST, "Talkgroup (%s) is marked as affiliation required and has a defined always send list! Always send peers take rule precedence and defined peers will always receive traffic.", groupName.c_str());
}
if (alwyCount > 0 && affil) {
::LogWarning(LOG_HOST, "Talkgroup (%s) is marked as affiliation required and has a defined always send list! Always send peers take rule precedence and defined peers will always receive traffic.", groupName.c_str());
}
::LogInfoEx(LOG_HOST, "Talkgroup NAME: %s SRC_TGID: %u SRC_TS: %u ACTIVE: %u PARROT: %u AFFILIATED: %u INCLUSIONS: %u EXCLUSIONS: %u REWRITES: %u ALWAYS: %u PREFERRED: %u PERMITTED RIDS: %u", groupName.c_str(), tgId, tgSlot, active, parrot, affil, incCount, excCount, rewrCount, alwyCount, prefCount, permRIDCount);
::LogInfoEx(LOG_HOST, "Talkgroup NAME: %s SRC_TGID: %u SRC_TS: %u ACTIVE: %u PARROT: %u AFFILIATED: %u INCLUSIONS: %u EXCLUSIONS: %u REWRITES: %u ALWAYS: %u PREFERRED: %u PERMITTED RIDS: %u", groupName.c_str(), tgId, tgSlot, active, parrot, affil, incCount, excCount, rewrCount, alwyCount, prefCount, permRIDCount);
}
}
__UNLOCK_TABLE();

@ -537,8 +537,9 @@ namespace lookups
* @param filename Full-path to the routing rules file.
* @param reloadTime Interval of time to reload the routing rules.
* @param acl Flag indicating these rules are enabled for enforcing access control.
* @param verbose Flag indicating if logging should be enabled for this lookup table.
*/
TalkgroupRulesLookup(const std::string& filename, uint32_t reloadTime, bool acl);
TalkgroupRulesLookup(const std::string& filename, uint32_t reloadTime, bool acl, bool verbose = true);
/**
* @brief Finalizes a instance of the TalkgroupRulesLookup class.
*/
@ -652,6 +653,8 @@ namespace lookups
bool m_acl;
bool m_stop;
bool m_verbose;
static std::mutex s_mutex; //!< Mutex used for change locking.
static bool s_locked; //!< Flag used for read locking (prevents find lookups), should be used when atomic operations (add/erase/etc) are being used.

@ -177,13 +177,15 @@ int HostFNE::run()
// try to load radio IDs table
std::string ridLookupFile = systemConf["radio_id"]["file"].as<std::string>();
uint32_t ridReloadTime = systemConf["radio_id"]["time"].as<uint32_t>(0U);
bool verboseRIDRules = systemConf["radio_id"]["verbose"].as<bool>(false);
LogInfo("Radio Id Lookups");
LogInfo(" File: %s", ridLookupFile.length() > 0U ? ridLookupFile.c_str() : "None");
if (ridReloadTime > 0U)
LogInfo(" Reload: %u mins", ridReloadTime);
LogInfo(" Verbose: %s", verboseRIDRules ? "true" : "false");
m_ridLookup = new RadioIdLookup(ridLookupFile, ridReloadTime, true);
m_ridLookup = new RadioIdLookup(ridLookupFile, ridReloadTime, true, verboseRIDRules);
m_ridLookup->read();
// initialize master networking
@ -400,6 +402,7 @@ bool HostFNE::readParams()
yaml::Node talkgroupRules = masterConf["talkgroup_rules"];
std::string talkgroupConfig = talkgroupRules["file"].as<std::string>();
uint32_t talkgroupConfigReload = talkgroupRules["time"].as<uint32_t>(30U);
bool verboseTalkgroupRules = talkgroupRules["verbose"].as<bool>(true);
yaml::Node adjSiteMapRules = masterConf["adj_site_map"];
std::string adjSiteMapConfig = adjSiteMapRules["file"].as<std::string>();
@ -417,13 +420,15 @@ bool HostFNE::readParams()
std::string peerListLookupFile = systemConf["peer_acl"]["file"].as<std::string>();
bool peerListLookupEnable = systemConf["peer_acl"]["enable"].as<bool>(false);
uint32_t peerListConfigReload = systemConf["peer_acl"]["time"].as<uint32_t>(30U);
bool verbosePeerListRules = systemConf["peer_acl"]["verbose"].as<bool>(true);
LogInfo("Talkgroup Rule Lookups");
LogInfo(" File: %s", talkgroupConfig.length() > 0U ? talkgroupConfig.c_str() : "None");
if (talkgroupConfigReload > 0U)
LogInfo(" Reload: %u mins", talkgroupConfigReload);
LogInfo(" Verbose: %s", verboseTalkgroupRules ? "true" : "false");
m_tidLookup = new TalkgroupRulesLookup(talkgroupConfig, talkgroupConfigReload, true);
m_tidLookup = new TalkgroupRulesLookup(talkgroupConfig, talkgroupConfigReload, true, verboseTalkgroupRules);
m_tidLookup->sendTalkgroups(sendTalkgroups);
m_tidLookup->read();
@ -433,8 +438,9 @@ bool HostFNE::readParams()
LogInfo(" File: %s", peerListLookupFile.length() > 0U ? peerListLookupFile.c_str() : "None");
if (peerListConfigReload > 0U)
LogInfo(" Reload: %u mins", peerListConfigReload);
LogInfo(" Verbose: %s", verbosePeerListRules ? "true" : "false");
m_peerListLookup = new PeerListLookup(peerListLookupFile, peerListConfigReload, peerListLookupEnable);
m_peerListLookup = new PeerListLookup(peerListLookupFile, peerListConfigReload, peerListLookupEnable, verbosePeerListRules);
m_peerListLookup->read();
LogInfo("Adjacent Site Map Lookups");

@ -326,28 +326,32 @@ int Host::run()
std::string ridLookupFile = systemConf["radio_id"]["file"].as<std::string>();
uint32_t ridReloadTime = systemConf["radio_id"]["time"].as<uint32_t>(0U);
bool ridAcl = systemConf["radio_id"]["acl"].as<bool>(false);
bool verboseRIDRules = systemConf["radio_id"]["verbose"].as<bool>(false);
LogInfo("Radio Id Lookups");
LogInfo(" File: %s", ridLookupFile.length() > 0U ? ridLookupFile.c_str() : "None");
if (ridReloadTime > 0U)
LogInfo(" Reload: %u mins", ridReloadTime);
LogInfo(" ACL: %s", ridAcl ? "yes" : "no");
LogInfo(" Verbose: %s", verboseRIDRules ? "true" : "false");
m_ridLookup = new RadioIdLookup(ridLookupFile, ridReloadTime, ridAcl);
m_ridLookup = new RadioIdLookup(ridLookupFile, ridReloadTime, ridAcl, verboseRIDRules);
m_ridLookup->read();
// try to load talkgroup IDs table
std::string tidLookupFile = systemConf["talkgroup_id"]["file"].as<std::string>();
uint32_t tidReloadTime = systemConf["talkgroup_id"]["time"].as<uint32_t>(0U);
bool tidAcl = systemConf["talkgroup_id"]["acl"].as<bool>(false);
bool verboseTalkgroupRules = systemConf["talkgroup_id"]["verbose"].as<bool>(true);
LogInfo("Talkgroup Rule Lookups");
LogInfo(" File: %s", tidLookupFile.length() > 0U ? tidLookupFile.c_str() : "None");
if (tidReloadTime > 0U)
LogInfo(" Reload: %u mins", tidReloadTime);
LogInfo(" ACL: %s", tidAcl ? "yes" : "no");
LogInfo(" Verbose: %s", verboseTalkgroupRules ? "true" : "false");
m_tidLookup = new TalkgroupRulesLookup(tidLookupFile, tidReloadTime, tidAcl);
m_tidLookup = new TalkgroupRulesLookup(tidLookupFile, tidReloadTime, tidAcl, verboseTalkgroupRules);
m_tidLookup->read();
// initialize networking

Loading…
Cancel
Save

Powered by TurnKey Linux.