mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 23:25:32 -04:00
- added more debug info to p3LinkMgr
- added check for banned IP from DHT at connection time - added regular removal of banned IPs from friend IP lists - increased time of banned IP storage to 1 week (previously 6 hours) - added save for banned IPs to keep them after restart (in bdfilter.cc) to file bdfilter.txt (can be manually updated) - changed mFiltered into a std::map for increased search efficiency - added secondary check of cert ID at connection time.-This line, and those below, will be ignored-- M libretroshare/src/pqi/p3netmgr.cc M libretroshare/src/pqi/pqimonitor.h M libretroshare/src/pqi/p3peermgr.cc M libretroshare/src/pqi/p3linkmgr.h M libretroshare/src/pqi/pqissllistener.cc M libretroshare/src/pqi/p3peermgr.h M libretroshare/src/pqi/p3linkmgr.cc M libretroshare/src/pqi/pqiperson.cc M libretroshare/src/pqi/pqissl.cc M libretroshare/src/rsserver/rsinit.cc M libretroshare/src/dht/p3bitdht_relay.cc M libretroshare/src/dht/p3bitdht.cc M libretroshare/src/dht/p3bitdht.h M libretroshare/src/retroshare/rsdht.h M libbitdht/src/udp/udpbitdht.h M libbitdht/src/udp/udpbitdht.cc M libbitdht/src/bitdht/bdmanager.cc M libbitdht/src/bitdht/bdmanager.h M libbitdht/src/bitdht/bdnode.h M libbitdht/src/bitdht/bdfilter.h M libbitdht/src/bitdht/bdfilter.cc M libbitdht/src/bitdht/bdnode.cc M libbitdht/src/bitdht/bdstore.h git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8289 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e9b9dce9f5
commit
5b2ba1e81c
23 changed files with 442 additions and 200 deletions
|
@ -47,6 +47,7 @@ const int p3connectzone = 3431;
|
|||
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsdht.h"
|
||||
|
||||
/* Network setup States */
|
||||
|
||||
|
@ -828,9 +829,9 @@ bool p3LinkMgrIMPL::connectResult(const RsPeerId &id, bool success, bool isIncom
|
|||
if (success)
|
||||
{
|
||||
/* update address (should also come through from DISC) */
|
||||
#ifdef LINKMGR_DEBUG_CONNFAIL
|
||||
#ifdef LINKMGR_DEBUG
|
||||
std::cerr << "p3LinkMgrIMPL::connectResult() Connect!: id: " << id << std::endl;
|
||||
std::cerr << " Success: " << success << " flags: " << flags << std::endl;
|
||||
std::cerr << " Success: " << success << " flags: " << flags << ", remote IP = " << sockaddr_storage_iptostring(remote_peer_address) << std::endl;
|
||||
#endif
|
||||
|
||||
#ifdef LINKMGR_DEBUG
|
||||
|
@ -1730,7 +1731,11 @@ bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &ad
|
|||
|
||||
std::list<struct sockaddr_storage>::const_iterator it;
|
||||
for(it = mBannedIpList.begin(); it != mBannedIpList.end(); ++it)
|
||||
{
|
||||
{
|
||||
#ifdef LINKMGR_DEBUG
|
||||
std::cerr << "Checking IP w.r.t. banned IP " << sockaddr_storage_iptostring(*it) << std::endl;
|
||||
#endif
|
||||
|
||||
if (sockaddr_storage_sameip(*it, addr))
|
||||
{
|
||||
#ifdef LINKMGR_DEBUG
|
||||
|
@ -1741,6 +1746,15 @@ bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &ad
|
|||
}
|
||||
}
|
||||
|
||||
if(rsDht != NULL && rsDht->isAddressBanned(addr))
|
||||
{
|
||||
#ifdef LINKMGR_DEBUG
|
||||
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr() adding to local Banned IPList";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
mBannedIpList.push_back(addr) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
/* if it is an external address, we'll accept it.
|
||||
* - even it is meant to be a local address.
|
||||
|
@ -1891,8 +1905,7 @@ void p3LinkMgrIMPL::locked_ConnectAttempt_HistoricalAddresses(peerConnectState
|
|||
std::cerr << "p3LinkMgrIMPL::locked_ConnectAttempt_HistoricalAddresses()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
for(ait = ipAddrs.mLocal.mAddrs.begin();
|
||||
ait != ipAddrs.mLocal.mAddrs.end(); ++ait)
|
||||
for(ait = ipAddrs.mLocal.mAddrs.begin(); ait != ipAddrs.mLocal.mAddrs.end(); ++ait)
|
||||
{
|
||||
if (locked_CheckPotentialAddr(ait->mAddr, now - ait->mSeenTime))
|
||||
{
|
||||
|
@ -2235,7 +2248,14 @@ void p3LinkMgrIMPL::printPeerLists(std::ostream &out)
|
|||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
bool p3LinkMgrIMPL::checkPotentialAddr(const sockaddr_storage &addr, time_t age)
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
return locked_CheckPotentialAddr(addr,age) ;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue