summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/conf/inspircd.conf.example4
-rw-r--r--docs/conf/providers/irccloud.conf.example1
-rw-r--r--src/modules/m_connflood.cpp13
3 files changed, 17 insertions, 1 deletions
diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example
index fecaafdc2..cdfb6f3c2 100644
--- a/docs/conf/inspircd.conf.example
+++ b/docs/conf/inspircd.conf.example
@@ -308,6 +308,10 @@
# This setting only has effect when the connectban module is loaded.
#useconnectban="yes"
+ # useconnflood: Defines if users in this class should be exempt from connflood limits.
+ # This setting only has effect when the connflood module is loaded.
+ #useconnflood="yes"
+
# usednsbl: Defines whether or not users in this class are subject to DNSBL. Default is yes.
# This setting only has effect when the dnsbl module is loaded.
#usednsbl="yes"
diff --git a/docs/conf/providers/irccloud.conf.example b/docs/conf/providers/irccloud.conf.example
index 559e93459..35f08590d 100644
--- a/docs/conf/providers/irccloud.conf.example
+++ b/docs/conf/providers/irccloud.conf.example
@@ -8,6 +8,7 @@
globalmax="100"
localmax="100"
useconnectban="no"
+ useconnflood="no"
usednsbl="no">
<connect name="IRCCloud (Brockwell)" parent="IRCCloud" allow="192.184.10.118">
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp
index 809055a5a..fe581e072 100644
--- a/src/modules/m_connflood.cpp
+++ b/src/modules/m_connflood.cpp
@@ -27,6 +27,7 @@
class ModuleConnFlood : public Module
{
+ private:
unsigned int seconds;
unsigned int timeout;
unsigned int boot_wait;
@@ -36,6 +37,16 @@ class ModuleConnFlood : public Module
time_t first;
std::string quitmsg;
+ static bool IsExempt(LocalUser* user)
+ {
+ // E-lined and already banned users shouldn't be hit.
+ if (user->exempt || user->quitting)
+ return true;
+
+ // Users in an exempt class shouldn't be hit.
+ return user->GetClass() && !user->GetClass()->config->getBool("useconnflood", true);
+ }
+
public:
ModuleConnFlood()
: conns(0), throttled(false)
@@ -65,7 +76,7 @@ public:
ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE
{
- if (user->exempt)
+ if (IsExempt(user))
return MOD_RES_PASSTHRU;
time_t next = ServerInstance->Time();