Skip to content

Commit 054d01d

Browse files
committed
Do not relay banned IP addresses
1 parent acbbb7b commit 054d01d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/net_processing.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,6 +2022,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
20222022
if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
20232023
addr.nTime = nNow - 5 * 24 * 60 * 60;
20242024
pfrom->AddAddressKnown(addr);
2025+
if (g_banman->IsBanned(addr)) continue; // Do not process banned addresses beyond remembering we received them
20252026
bool fReachable = IsReachable(addr);
20262027
if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && addr.IsRoutable())
20272028
{
@@ -2912,8 +2913,11 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
29122913
pfrom->vAddrToSend.clear();
29132914
std::vector<CAddress> vAddr = connman->GetAddresses();
29142915
FastRandomContext insecure_rand;
2915-
for (const CAddress &addr : vAddr)
2916-
pfrom->PushAddress(addr, insecure_rand);
2916+
for (const CAddress &addr : vAddr) {
2917+
if (!g_banman->IsBanned(addr)) {
2918+
pfrom->PushAddress(addr, insecure_rand);
2919+
}
2920+
}
29172921
return true;
29182922
}
29192923

0 commit comments

Comments
 (0)