summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2013-04-21 05:41:09 +0100
committerPeter Powell <petpow@saberuk.com>2013-04-27 05:59:54 +0100
commitf2566ff550bc3516eb35fab76217384866de8bcb (patch)
tree06b001530ef64b7a78d271197cf838a2760edfef
parent79e462c530a4617d688ca3c648ece2d8ebb7396a (diff)
Move <performance:nouserdns> to <connect:nouserdns>.
-rw-r--r--docs/conf/inspircd.conf.example14
-rw-r--r--include/users.h4
-rw-r--r--src/commands/cmd_hostname_lookup.cpp10
-rw-r--r--src/configreader.cpp14
-rw-r--r--src/modules/m_cgiirc.cpp5
-rw-r--r--src/users.cpp6
6 files changed, 29 insertions, 24 deletions
diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example
index 173355acd..e0ed5e67e 100644
--- a/docs/conf/inspircd.conf.example
+++ b/docs/conf/inspircd.conf.example
@@ -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 #-#-#-#-#-#-#-#-#-#-#-#
# #
diff --git a/include/users.h b/include/users.h
index 9b7d28d31..0f57074b2 100644
--- a/include/users.h
+++ b/include/users.h
@@ -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);
diff --git a/src/commands/cmd_hostname_lookup.cpp b/src/commands/cmd_hostname_lookup.cpp
index 04592c6e5..d43730b94 100644
--- a/src/commands/cmd_hostname_lookup.cpp
+++ b/src/commands/cmd_hostname_lookup.cpp
@@ -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;
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 32e8966fa..1b565c7f7 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -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()
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 9d87a01b3..bbb6151bd 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -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?
diff --git a/src/users.cpp b/src/users.cpp
index d6363171c..623af7fe3 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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;
}