correct issue with passing a key request to the upstream master; comment on self-delete operations, stop() for lookup tables;

pull/86/head
Bryan Biedenkapp 11 months ago
parent a2fa303217
commit 2258e3a065

@ -86,6 +86,7 @@ namespace lookups
/** /**
* @brief Stops and unloads this lookup table. * @brief Stops and unloads this lookup table.
* (NOTE: If the reload time for this lookup table is set to 0, a call to stop will also delete the object.)
* @param noDestroy Flag indicating the lookup table should remain resident in memory after stopping. * @param noDestroy Flag indicating the lookup table should remain resident in memory after stopping.
*/ */
virtual void stop(bool noDestroy = false) virtual void stop(bool noDestroy = false)

@ -240,7 +240,7 @@ bool PeerListLookup::load()
m_table[id] = PeerId(id, alias, password, peerLink, canRequestKeys, false); m_table[id] = PeerId(id, alias, password, peerLink, canRequestKeys, false);
// Log depending on what was loaded // Log depending on what was loaded
LogMessage(LOG_HOST, "Loaded peer ID %u%s into peer ID lookup table, %s%s", id, LogMessage(LOG_HOST, "Loaded peer ID %u%s into peer ID lookup table, %s%s%s", id,
(!alias.empty() ? (" (" + alias + ")").c_str() : ""), (!alias.empty() ? (" (" + alias + ")").c_str() : ""),
(!password.empty() ? "using unique peer password" : "using master password"), (!password.empty() ? "using unique peer password" : "using master password"),
(peerLink) ? ", Peer-Link Enabled" : "", (peerLink) ? ", Peer-Link Enabled" : "",

@ -557,6 +557,7 @@ namespace lookups
void stop(bool noDestroy = false); void stop(bool noDestroy = false);
/** /**
* @brief Reads the lookup table from the specified lookup table file. * @brief Reads the lookup table from the specified lookup table file.
* (NOTE: If the reload time for this lookup table is set to 0, a call to stop will also delete the object.)
* @returns bool True, if lookup table was read, otherwise false. * @returns bool True, if lookup table was read, otherwise false.
*/ */
bool read(); bool read();

@ -184,6 +184,7 @@ public:
/** /**
* @brief Stops and unloads this lookup table. * @brief Stops and unloads this lookup table.
* (NOTE: If the reload time for this lookup table is set to 0, a call to stop will also delete the object.)
* @param noDestroy Flag indicating the lookup table should remain resident in memory after stopping. * @param noDestroy Flag indicating the lookup table should remain resident in memory after stopping.
*/ */
void stop(bool noDestroy = false); void stop(bool noDestroy = false);

@ -295,6 +295,11 @@ int HostFNE::run()
m_peerListLookup->setReloadTime(0U); // no reload m_peerListLookup->setReloadTime(0U); // no reload
m_peerListLookup->stop(); m_peerListLookup->stop();
} }
if (m_cryptoLookup != nullptr) {
m_cryptoLookup->setReloadTime(0U); // no reload
m_cryptoLookup->stop();
}
#if !defined(_WIN32) #if !defined(_WIN32)
if (m_tun != nullptr) { if (m_tun != nullptr) {
if (m_tun->isUp()) { if (m_tun->isUp()) {

@ -1122,8 +1122,10 @@ void* FNENetwork::threadedNetworkRx(void* arg)
if (peerEntry.peerDefault()) { if (peerEntry.peerDefault()) {
break; break;
} else { } else {
if (!peerEntry.canRequestKeys()) if (!peerEntry.canRequestKeys()) {
LogError(LOG_NET, "PEER %u (%s) requested enc. key but is not allowed, no response", peerId, connection->identity().c_str());
break; break;
}
} }
} }
} }
@ -1188,15 +1190,15 @@ void* FNENetwork::threadedNetworkRx(void* arg)
for (auto peer : network->m_host->m_peerNetworks) { for (auto peer : network->m_host->m_peerNetworks) {
if (peer.second != nullptr) { if (peer.second != nullptr) {
if (peer.second->isEnabled() && peer.second->isPeerLink()) { if (peer.second->isEnabled() && peer.second->isPeerLink()) {
LogMessage(LOG_NET, "PEER %u (%s) requesting key from upstream master, algId = $%02X, kID = $%04X", peerId, connection->identity().c_str(), LogMessage(LOG_NET, "PEER %u (%s) no local key or container, requesting key from upstream master, algId = $%02X, kID = $%04X", peerId, connection->identity().c_str(),
modifyKey->getAlgId(), modifyKey->getKId()); modifyKey->getAlgId(), modifyKey->getKId());
network->m_keyQueueMutex.try_lock_for(std::chrono::milliseconds(60)); network->m_keyQueueMutex.try_lock_for(std::chrono::milliseconds(60));
network->m_peerLinkKeyQueue[peerId] = modifyKey->getKId(); network->m_peerLinkKeyQueue[peerId] = modifyKey->getKId();
network->m_keyQueueMutex.unlock(); network->m_keyQueueMutex.unlock();
peer.second->writeMaster({ NET_FUNC::KEY_RSP, NET_SUBFUNC::NOP }, peer.second->writeMaster({ NET_FUNC::KEY_REQ, NET_SUBFUNC::NOP },
req->buffer, req->length, RTP_END_OF_CALL_SEQ, 0U, false, false, peerId); req->buffer, req->length, RTP_END_OF_CALL_SEQ, 0U, false, false);
} }
} }
} }
@ -2640,7 +2642,7 @@ void FNENetwork::processTEKResponse(p25::kmm::KeyItem* rspKi, uint8_t algId, uin
if (rspKi == nullptr) if (rspKi == nullptr)
return; return;
LogMessage(LOG_NET, "Remote enc. key, algId = $%02X, kID = $%04X", algId, rspKi->kId()); LogMessage(LOG_NET, "upstream master enc. key, algId = $%02X, kID = $%04X", algId, rspKi->kId());
m_keyQueueMutex.lock(); m_keyQueueMutex.lock();

Loading…
Cancel
Save

Powered by TurnKey Linux.