fix issue where peer identity was being used instead of peer ID for FNE peer network lists; appropriately log blockTrafficTo configurations at startup;

pull/85/head
Bryan Biedenkapp 10 months ago
parent 5ecfc58300
commit ecc8bfa32e

@ -163,7 +163,7 @@ peers:
# Network Peer ID # Network Peer ID
peerId: 9000990 peerId: 9000990
# List of peer IDs to block sending traffic to from this peer. # List of peer IDs to block traffic to for this peer.
blockTrafficTo: [] blockTrafficTo: []
# Flag indicating whether or not peer endpoint networking is encrypted. # Flag indicating whether or not peer endpoint networking is encrypted.

@ -806,6 +806,7 @@ bool HostFNE::createPeerNetworks()
for (size_t i = 0; i < blockTrafficTo.size(); i++) { for (size_t i = 0; i < blockTrafficTo.size(); i++) {
uint32_t peerId = (uint32_t)::strtoul(blockTrafficTo[i].as<std::string>("0").c_str(), NULL, 10); uint32_t peerId = (uint32_t)::strtoul(blockTrafficTo[i].as<std::string>("0").c_str(), NULL, 10);
if (peerId != 0U) { if (peerId != 0U) {
::LogInfoEx(LOG_HOST, "Peer ID %u Blocks Traffic To PEER %u", id, peerId);
network->addBlockedTrafficPeer(peerId); network->addBlockedTrafficPeer(peerId);
} }
} }
@ -822,7 +823,7 @@ bool HostFNE::createPeerNetworks()
} }
if (network != nullptr) if (network != nullptr)
m_peerNetworks[identity] = network; m_peerNetworks[id] = network;
} }
} }

@ -107,7 +107,7 @@ private:
CryptoContainer* m_cryptoLookup; CryptoContainer* m_cryptoLookup;
std::unordered_map<std::string, network::PeerNetwork*> m_peerNetworks; std::unordered_map<uint32_t, network::PeerNetwork*> m_peerNetworks;
uint32_t m_pingTime; uint32_t m_pingTime;
uint32_t m_maxMissedPings; uint32_t m_maxMissedPings;

@ -10,6 +10,7 @@
#include "fne/Defines.h" #include "fne/Defines.h"
#include "common/network/json/json.h" #include "common/network/json/json.h"
#include "common/zlib/zlib.h" #include "common/zlib/zlib.h"
#include "common/Log.h"
#include "common/Utils.h" #include "common/Utils.h"
#include "fne/network/PeerNetwork.h" #include "fne/network/PeerNetwork.h"
@ -77,13 +78,22 @@ uint32_t PeerNetwork::getRxDMRStreamId(uint32_t slotNo) const
bool PeerNetwork::checkBlockedPeer(uint32_t peerId) bool PeerNetwork::checkBlockedPeer(uint32_t peerId)
{ {
if (!m_enabled)
return false;
if (m_blockTrafficToTable.empty()) if (m_blockTrafficToTable.empty())
return false; return false;
if (std::find(m_blockTrafficToTable.begin(), m_blockTrafficToTable.end(), peerId) != m_blockTrafficToTable.end()) { if (std::find(m_blockTrafficToTable.begin(), m_blockTrafficToTable.end(), peerId) != m_blockTrafficToTable.end()) {
if (m_debug) {
::LogDebugEx(LOG_HOST, "PeerNetwork::checkBlockedPeer()", "PEER %u peerId = %u, blocking traffic", m_peerId, peerId);
}
return true; return true;
} }
if (m_debug) {
::LogDebugEx(LOG_HOST, "PeerNetwork::checkBlockedPeer()", "PEER %u peerId = %u, passing traffic", m_peerId, peerId);
}
return false; return false;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.