mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #7072
bc7cd78
p2p: drop peers that spam peer lists (moneromooo-monero)
This commit is contained in:
commit
b7425c14c8
2 changed files with 6 additions and 0 deletions
|
@ -132,6 +132,7 @@
|
|||
#define P2P_DEFAULT_HANDSHAKE_INTERVAL 60 //secondes
|
||||
#define P2P_DEFAULT_PACKET_MAX_SIZE 50000000 //50000000 bytes maximum packet size
|
||||
#define P2P_DEFAULT_PEERS_IN_HANDSHAKE 250
|
||||
#define P2P_MAX_PEERS_IN_HANDSHAKE 250
|
||||
#define P2P_DEFAULT_CONNECTION_TIMEOUT 5000 //5 seconds
|
||||
#define P2P_DEFAULT_SOCKS_CONNECT_TIMEOUT 45 // seconds
|
||||
#define P2P_DEFAULT_PING_CONNECTION_TIMEOUT 2000 //2 seconds
|
||||
|
|
|
@ -2064,6 +2064,11 @@ namespace nodetool
|
|||
template<class t_payload_net_handler>
|
||||
bool node_server<t_payload_net_handler>::handle_remote_peerlist(const std::vector<peerlist_entry>& peerlist, const epee::net_utils::connection_context_base& context)
|
||||
{
|
||||
if (peerlist.size() > P2P_MAX_PEERS_IN_HANDSHAKE)
|
||||
{
|
||||
MWARNING(context << "peer sent " << peerlist.size() << " peers, considered spamming");
|
||||
return false;
|
||||
}
|
||||
std::vector<peerlist_entry> peerlist_ = peerlist;
|
||||
if(!sanitize_peerlist(peerlist_))
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue