mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
added load/save of banlists
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8320 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f699855b7d
commit
b2967418ff
4 changed files with 27 additions and 11 deletions
|
@ -105,7 +105,9 @@ bool p3ServiceServer::recvItem(RsRawItem *item)
|
|||
// This doesn't need to be in Mutex.
|
||||
if (!mServiceControl->checkFilter(item->PacketId() & 0xffffff00, item->PeerId()))
|
||||
{
|
||||
std::cerr << "p3ServiceServer::recvItem() Fails Filtering " << std::endl;
|
||||
#ifdef SERVICE_DEBUG
|
||||
std::cerr << "p3ServiceServer::recvItem() Fails Filtering " << std::endl;
|
||||
#endif
|
||||
delete item;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1590,10 +1590,11 @@ int RsServer::StartupRetroShare()
|
|||
mConfigMgr->addConfiguration("peers.cfg", mPeerMgr);
|
||||
mConfigMgr->addConfiguration("general.cfg", mGeneralConfig);
|
||||
mConfigMgr->addConfiguration("msgs.cfg", msgSrv);
|
||||
mConfigMgr->addConfiguration("chat.cfg", chatSrv);
|
||||
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
|
||||
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
|
||||
mConfigMgr->addConfiguration("turtle.cfg", tr);
|
||||
mConfigMgr->addConfiguration("chat.cfg", chatSrv);
|
||||
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
|
||||
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
|
||||
mConfigMgr->addConfiguration("turtle.cfg", tr);
|
||||
mConfigMgr->addConfiguration("banlist.cfg", mBanList);
|
||||
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
|
||||
#ifdef ENABLE_GROUTER
|
||||
mConfigMgr->addConfiguration("grouter.cfg", gr);
|
||||
|
@ -1601,7 +1602,7 @@ int RsServer::StartupRetroShare()
|
|||
mConfigMgr->addConfiguration("p3identity.cfg", mGxsIdService);
|
||||
|
||||
#ifdef RS_USE_BITDHT
|
||||
mConfigMgr->addConfiguration("bitdht.cfg", mBitDht);
|
||||
mConfigMgr->addConfiguration("bitdht.cfg", mBitDht);
|
||||
#endif
|
||||
|
||||
#ifdef RS_ENABLE_GXS
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#define RSBANLIST_ENTRY_MAX_AGE (60 * 60 * 1) // 1 HOURS
|
||||
#define RSBANLIST_SEND_PERIOD 600 // 10 Minutes.
|
||||
|
||||
#define RSBANLIST_DELAY_BETWEEN_TALK_TO_DHT 60 // should be more: e.g. 600 secs.
|
||||
#define RSBANLIST_DELAY_BETWEEN_TALK_TO_DHT 240 // every 4 mins.
|
||||
#define RSBANLIST_DEFAULT_AUTORANGE_LIMIT 3 // default number of IPs in same range to trigger a complete IP range filter.
|
||||
#define RSBANLIST_DEFAULT_AUTORANGE_ENABLED true
|
||||
#define RSBANLIST_DEFAULT_FRIEND_GATHERING_ENABLED true
|
||||
|
@ -103,16 +103,22 @@ void p3BanList::enableIPsFromDHT(bool b)
|
|||
{
|
||||
mIPDHTGatheringEnabled = b;
|
||||
mLastDhtInfoRequest=0;
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
void p3BanList::enableAutoRange(bool b)
|
||||
{
|
||||
mAutoRangeIps = b;
|
||||
autoFigureOutBanRanges() ;
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
void p3BanList::setAutoRangeLimit(int n)
|
||||
{
|
||||
mAutoRangeLimit = n;
|
||||
autoFigureOutBanRanges();
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
|
||||
class ZeroedInt
|
||||
|
@ -188,6 +194,8 @@ void p3BanList::autoFigureOutBanRanges()
|
|||
else
|
||||
++it;
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
if(!mAutoRangeIps)
|
||||
return ;
|
||||
#ifdef DEBUG_BANLIST
|
||||
|
@ -363,6 +371,8 @@ void p3BanList::addIpRange(const sockaddr_storage &addr, int masked_bytes,uint32
|
|||
mWhiteListedRanges[addrrange] = blp ;
|
||||
else
|
||||
std::cerr << "(EE) Cannot add IP range. Bad list_type. Should be eiter RSBANLIST_CHECKING_FLAGS_BLACKLIST or RSBANLIST_CHECKING_FLAGS_WHITELIST" << std::endl;
|
||||
|
||||
IndicateConfigChanged() ;
|
||||
}
|
||||
|
||||
int p3BanList::tick()
|
||||
|
@ -686,7 +696,9 @@ bool p3BanList::addBanEntry(const RsPeerId &peerId, const struct sockaddr_storag
|
|||
it->second.mLastUpdate = now;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
IndicateConfigChanged();
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue