aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_connectban.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-04-05 23:37:33 +0100
committerGravatar Sadie Powell2022-04-05 23:37:33 +0100
commit72372136c46e1863ba09140f1d79e2e53270b86b (patch)
tree05468ef0c90e6caa9eeb4ce9b74fd88f77c901be /src/modules/m_connectban.cpp
parentRelease v4.0.0 alpha 9. (diff)
parentUse consistent xline messages locally (diff)
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules/m_connectban.cpp')
-rw-r--r--src/modules/m_connectban.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp
index cee68a5fb..96ae13fa6 100644
--- a/src/modules/m_connectban.cpp
+++ b/src/modules/m_connectban.cpp
@@ -100,12 +100,12 @@ public:
{
auto tag = ServerInstance->Config->ConfValue("connectban");
- ipv4_cidr = static_cast<unsigned int>(tag->getUInt("ipv4cidr", 32, 1, 32));
- ipv6_cidr = static_cast<unsigned int>(tag->getUInt("ipv6cidr", 128, 1, 128));
+ ipv4_cidr = static_cast<unsigned int>(tag->getUInt("ipv4cidr", ServerInstance->Config->c_ipv4_range, 1, 32));
+ ipv6_cidr = static_cast<unsigned int>(tag->getUInt("ipv6cidr", ServerInstance->Config->c_ipv6_range, 1, 128));
threshold = tag->getUInt("threshold", 10, 1);
bootwait = tag->getDuration("bootwait", 60*2);
splitwait = tag->getDuration("splitwait", 60*2);
- banduration = tag->getDuration("banduration", 10*60, 1);
+ banduration = tag->getDuration("banduration", 6*60*60, 1);
banmessage = tag->getString("banmessage", "Your IP range has been attempting to connect too many times in too short a duration. Wait a while, and you will be able to connect.");
if (status.initial)
@@ -147,18 +147,19 @@ public:
if (i->second >= threshold)
{
// Create Z-line for set duration.
- ZLine* zl = new ZLine(ServerInstance->Time(), banduration, ServerInstance->Config->ServerName, banmessage, mask.str());
+ ZLine* zl = new ZLine(ServerInstance->Time(), banduration, MODNAME "@" + ServerInstance->Config->ServerName, banmessage, mask.str());
if (!ServerInstance->XLines->AddLine(zl, NULL))
{
delete zl;
return;
}
- ServerInstance->XLines->ApplyLines();
std::string maskstr = mask.str();
- ServerInstance->SNO.WriteGlobalSno('x', "Z-line added by module m_connectban on %s to expire in %s (on %s): Connect flooding",
- maskstr.c_str(), InspIRCd::DurationString(zl->duration).c_str(), InspIRCd::TimeString(zl->expiry).c_str());
+ ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed Z-line on %s, expires in %s (on %s): %s",
+ zl->source.c_str(), maskstr.c_str(), InspIRCd::DurationString(zl->duration).c_str(),
+ InspIRCd::TimeString(zl->expiry).c_str(), zl->reason.c_str());
ServerInstance->SNO.WriteGlobalSno('a', "Connect flooding from IP range %s (%lu)", maskstr.c_str(), threshold);
connects.erase(i);
+ ServerInstance->XLines->ApplyLines();
}
}
else