Move <performance:nouserdns> to <connect:nouserdns>.

This commit is contained in:
Peter Powell 2013-04-21 05:41:09 +01:00
parent 79e462c530
commit f2566ff550
6 changed files with 29 additions and 24 deletions

View File

@ -275,6 +275,10 @@
# maxconnwarn: Enable warnings when localmax or globalmax is hit (defaults to on)
maxconnwarn="off"
# nouserdns: If enabled, no DNS lookups will be performed on connecting users
# in this class. This can save a lot of resources on very busy servers.
nouserdns="no"
# usednsbl: Defines whether or not users in this class are subject to DNSBL. Default is yes.
# This setting only has effect when m_dnsbl is loaded.
#usednsbl="yes"
@ -380,6 +384,10 @@
# globalmax: Maximum global (network-wide) connections per IP.
globalmax="3"
# nouserdns: If enabled, no DNS lookups will be performed on connecting users
# in this class. This can save a lot of resources on very busy servers.
nouserdns="no"
# useident: Defines if users in this class must respond to a ident query or not.
useident="no"
@ -647,11 +655,7 @@
# +C and +Q snomasks. Setting this to yes squelches those messages,
# which makes it easier for opers, but degrades the functionality of
# bots like BOPM during netsplits.
quietbursts="yes"
# nouserdns: If enabled, no DNS lookups will be performed on
# connecting users. This can save a lot of resources on very busy servers.
nouserdns="no">
quietbursts="yes">
#-#-#-#-#-#-#-#-#-#-#-# SECURITY CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-#
# #

View File

@ -144,6 +144,10 @@ struct CoreExport ConnectClass : public refcountbase
*/
unsigned long limit;
/** If set to true, no user DNS lookups are to be performed
*/
bool nouserdns;
/** Create a new connect class with no settings.
*/
ConnectClass(ConfigTag* tag, char type, const std::string& mask);

View File

@ -177,7 +177,6 @@ class UserResolver : public DNS::Request
class ModuleHostnameLookup : public Module
{
bool nouserdns;
LocalIntExt dnsLookup;
LocalStringExt ptrHosts;
dynamic_reference<DNS::Manager> DNS;
@ -198,18 +197,13 @@ class ModuleHostnameLookup : public Module
ServerInstance->Modules->AddService(this->dnsLookup);
ServerInstance->Modules->AddService(this->ptrHosts);
Implementation i[] = { I_OnUserInit, I_OnCheckReady, I_OnRehash };
Implementation i[] = { I_OnUserInit, I_OnCheckReady };
ServerInstance->Modules->Attach(i, this, sizeof(i) / sizeof(Implementation));
}
void OnRehash(User* user)
{
nouserdns = ServerInstance->Config->ConfValue("performance")->getBool("nouserdns");
}
void OnUserInit(LocalUser *user)
{
if (!DNS || nouserdns)
if (!DNS || user->MyClass->nouserdns)
{
user->WriteServ("NOTICE %s :*** Skipping host resolution (disabled by server administrator)", user->nick.c_str());
return;

View File

@ -313,6 +313,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current)
me->maxchans = tag->getInt("maxchans", me->maxchans);
me->maxconnwarn = tag->getBool("maxconnwarn", me->maxconnwarn);
me->limit = tag->getInt("limit", me->limit);
me->nouserdns = tag->getBool("nouserdns", me->nouserdns);
ClassMap::iterator oldMask = oldBlocksByMask.find(typeMask);
if (oldMask != oldBlocksByMask.end())
@ -346,12 +347,13 @@ struct DeprecatedConfig
};
static const DeprecatedConfig ChangedConfig[] = {
{ "bind", "transport", "", "has been moved to <bind:ssl> as of 2.0" },
{ "die", "value", "", "you need to reread your config" },
{ "link", "autoconnect", "", "2.0+ does not use this attribute - define <autoconnect> tags instead" },
{ "link", "transport", "", "has been moved to <link:ssl> as of 2.0" },
{ "module", "name", "m_chanprotect.so", "has been replaced with m_customprefix as of 2.2" },
{ "module", "name", "m_halfop.so", "has been replaced with m_customprefix as of 2.2" },
{ "bind", "transport", "", "has been moved to <bind:ssl> as of 2.0" },
{ "die", "value", "", "you need to reread your config" },
{ "link", "autoconnect", "", "2.0+ does not use this attribute - define <autoconnect> tags instead" },
{ "link", "transport", "", "has been moved to <link:ssl> as of 2.0" },
{ "module", "name", "m_chanprotect.so", "has been replaced with m_customprefix as of 2.2" },
{ "module", "name", "m_halfop.so", "has been replaced with m_customprefix as of 2.2" },
{ "performance", "nouserdns", "", "has been moved to <connect:nouserdns> as of 2.2" }
};
void ServerConfig::Fill()

View File

@ -182,7 +182,6 @@ class ModuleCgiIRC : public Module
CommandWebirc cmd;
LocalIntExt waiting;
dynamic_reference<DNS::Manager> DNS;
bool nouserdns;
static void RecheckClass(LocalUser* user)
{
@ -207,8 +206,9 @@ class ModuleCgiIRC : public Module
user->host = user->dhost = user->GetIPString();
user->InvalidateCache();
RecheckClass(user);
// Don't create the resolver if the core couldn't put the user in a connect class or when dns is disabled
if (user->quitting || !DNS || nouserdns)
if (user->quitting || !DNS || user->MyClass->nouserdns)
return;
CGIResolver* r = new CGIResolver(*this->DNS, this, cmd.notify, newip, user, (was_pass ? "PASS" : "IDENT"), waiting);
@ -248,7 +248,6 @@ public:
void OnRehash(User* user)
{
nouserdns = ServerInstance->Config->ConfValue("performance")->getBool("nouserdns");
cmd.Hosts.clear();
// Do we send an oper notice when a CGI:IRC has their host changed?

View File

@ -1610,7 +1610,8 @@ const std::string& FakeUser::GetFullRealHost()
ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask)
: config(tag), type(t), fakelag(true), name("unnamed"), registration_timeout(0), host(mask),
pingtime(0), softsendqmax(0), hardsendqmax(0), recvqmax(0),
penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(0), limit(0)
penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(0),
limit(0), nouserdns(false)
{
}
@ -1620,7 +1621,7 @@ ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask, cons
softsendqmax(parent.softsendqmax), hardsendqmax(parent.hardsendqmax), recvqmax(parent.recvqmax),
penaltythreshold(parent.penaltythreshold), commandrate(parent.commandrate),
maxlocal(parent.maxlocal), maxglobal(parent.maxglobal), maxconnwarn(parent.maxconnwarn), maxchans(parent.maxchans),
limit(parent.limit)
limit(parent.limit), nouserdns(parent.nouserdns)
{
}
@ -1643,4 +1644,5 @@ void ConnectClass::Update(const ConnectClass* src)
maxconnwarn = src->maxconnwarn;
maxchans = src->maxchans;
limit = src->limit;
nouserdns = src->nouserdns;
}