mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 16:27:01 -05: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
@ -105,7 +105,9 @@ bool p3ServiceServer::recvItem(RsRawItem *item)
|
|||||||
// This doesn't need to be in Mutex.
|
// This doesn't need to be in Mutex.
|
||||||
if (!mServiceControl->checkFilter(item->PacketId() & 0xffffff00, item->PeerId()))
|
if (!mServiceControl->checkFilter(item->PacketId() & 0xffffff00, item->PeerId()))
|
||||||
{
|
{
|
||||||
|
#ifdef SERVICE_DEBUG
|
||||||
std::cerr << "p3ServiceServer::recvItem() Fails Filtering " << std::endl;
|
std::cerr << "p3ServiceServer::recvItem() Fails Filtering " << std::endl;
|
||||||
|
#endif
|
||||||
delete item;
|
delete item;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1594,6 +1594,7 @@ int RsServer::StartupRetroShare()
|
|||||||
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
|
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
|
||||||
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
|
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
|
||||||
mConfigMgr->addConfiguration("turtle.cfg", tr);
|
mConfigMgr->addConfiguration("turtle.cfg", tr);
|
||||||
|
mConfigMgr->addConfiguration("banlist.cfg", mBanList);
|
||||||
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
|
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
|
||||||
#ifdef ENABLE_GROUTER
|
#ifdef ENABLE_GROUTER
|
||||||
mConfigMgr->addConfiguration("grouter.cfg", gr);
|
mConfigMgr->addConfiguration("grouter.cfg", gr);
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
#define RSBANLIST_ENTRY_MAX_AGE (60 * 60 * 1) // 1 HOURS
|
#define RSBANLIST_ENTRY_MAX_AGE (60 * 60 * 1) // 1 HOURS
|
||||||
#define RSBANLIST_SEND_PERIOD 600 // 10 Minutes.
|
#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_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_AUTORANGE_ENABLED true
|
||||||
#define RSBANLIST_DEFAULT_FRIEND_GATHERING_ENABLED true
|
#define RSBANLIST_DEFAULT_FRIEND_GATHERING_ENABLED true
|
||||||
@ -103,16 +103,22 @@ void p3BanList::enableIPsFromDHT(bool b)
|
|||||||
{
|
{
|
||||||
mIPDHTGatheringEnabled = b;
|
mIPDHTGatheringEnabled = b;
|
||||||
mLastDhtInfoRequest=0;
|
mLastDhtInfoRequest=0;
|
||||||
|
|
||||||
|
IndicateConfigChanged();
|
||||||
}
|
}
|
||||||
void p3BanList::enableAutoRange(bool b)
|
void p3BanList::enableAutoRange(bool b)
|
||||||
{
|
{
|
||||||
mAutoRangeIps = b;
|
mAutoRangeIps = b;
|
||||||
autoFigureOutBanRanges() ;
|
autoFigureOutBanRanges() ;
|
||||||
|
|
||||||
|
IndicateConfigChanged();
|
||||||
}
|
}
|
||||||
void p3BanList::setAutoRangeLimit(int n)
|
void p3BanList::setAutoRangeLimit(int n)
|
||||||
{
|
{
|
||||||
mAutoRangeLimit = n;
|
mAutoRangeLimit = n;
|
||||||
autoFigureOutBanRanges();
|
autoFigureOutBanRanges();
|
||||||
|
|
||||||
|
IndicateConfigChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ZeroedInt
|
class ZeroedInt
|
||||||
@ -188,6 +194,8 @@ void p3BanList::autoFigureOutBanRanges()
|
|||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
|
|
||||||
|
IndicateConfigChanged();
|
||||||
|
|
||||||
if(!mAutoRangeIps)
|
if(!mAutoRangeIps)
|
||||||
return ;
|
return ;
|
||||||
#ifdef DEBUG_BANLIST
|
#ifdef DEBUG_BANLIST
|
||||||
@ -363,6 +371,8 @@ void p3BanList::addIpRange(const sockaddr_storage &addr, int masked_bytes,uint32
|
|||||||
mWhiteListedRanges[addrrange] = blp ;
|
mWhiteListedRanges[addrrange] = blp ;
|
||||||
else
|
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;
|
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()
|
int p3BanList::tick()
|
||||||
@ -687,6 +697,8 @@ bool p3BanList::addBanEntry(const RsPeerId &peerId, const struct sockaddr_storag
|
|||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IndicateConfigChanged();
|
||||||
|
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,18 +479,19 @@ void ServerPage::addPeerToIPTable(QTableWidget *table,int row,const BanListPeer&
|
|||||||
switch( blp.reason )
|
switch( blp.reason )
|
||||||
{
|
{
|
||||||
case RSBANLIST_REASON_DHT: table->setItem(row,COLUMN_REASON,new QTableWidgetItem(QString("Bad peer (DHT)"))) ;
|
case RSBANLIST_REASON_DHT: table->setItem(row,COLUMN_REASON,new QTableWidgetItem(QString("Bad peer (DHT)"))) ;
|
||||||
|
table->setItem(row,COLUMN_COMMENT,new QTableWidgetItem(tr("Reported by DHT for IP masquerading"))) ;
|
||||||
break ;
|
break ;
|
||||||
case RSBANLIST_REASON_USER: table->setItem(row,COLUMN_REASON,new QTableWidgetItem(QString("Home-made rule"))) ;
|
case RSBANLIST_REASON_USER: table->setItem(row,COLUMN_REASON,new QTableWidgetItem(QString("Home-made rule"))) ;
|
||||||
|
table->setItem(row,COLUMN_COMMENT,new QTableWidgetItem(QString::fromStdString(blp.comment))) ;
|
||||||
break ;
|
break ;
|
||||||
case RSBANLIST_REASON_AUTO_RANGE: table->setItem(row,COLUMN_REASON,new QTableWidgetItem(QString("Auto-generated range"))) ;
|
case RSBANLIST_REASON_AUTO_RANGE: table->setItem(row,COLUMN_REASON,new QTableWidgetItem(QString("Auto-generated range"))) ;
|
||||||
table->setItem(row,COLUMN_COMMENT,new QTableWidgetItem(tr("Range made from %1 collected addresses").arg(QString::number(blp.connect_attempts)))) ;
|
table->setItem(row,COLUMN_COMMENT,new QTableWidgetItem(tr("Range made from %1 collected addresses").arg(QString::number(blp.connect_attempts)))) ;
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
case RSBANLIST_REASON_UNKNOWN: table->setItem(row,COLUMN_REASON,new QTableWidgetItem(QString("Unknown"))) ;
|
case RSBANLIST_REASON_UNKNOWN: table->setItem(row,COLUMN_REASON,new QTableWidgetItem(QString("Unknown"))) ;
|
||||||
|
table->setItem(row,COLUMN_COMMENT,new QTableWidgetItem(QString::fromStdString(blp.comment))) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
table->setItem(row,COLUMN_COMMENT,new QTableWidgetItem(QString::fromStdString(blp.comment))) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user