diff options
author | Adam <Adam@anope.org> | 2013-09-19 13:35:52 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-09-19 13:35:52 -0400 |
commit | b880240d727a4375522851daea0abf468f588a78 (patch) | |
tree | 8928bbbbbde4c0946cecd859feb5798cd4d79c53 /src/sockets.cpp | |
parent | 5ce90ba7d153f10b1cef876fd4201087be9964ff (diff) |
Make os_session akill ip ranges and not individual user's ips
Diffstat (limited to 'src/sockets.cpp')
-rw-r--r-- | src/sockets.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/sockets.cpp b/src/sockets.cpp index e3065a1e8..3ce6c8eac 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -91,6 +91,11 @@ Anope::string sockaddrs::addr() const return ""; } +bool sockaddrs::ipv6() const +{ + return sa.sa_family == AF_INET6; +} + bool sockaddrs::operator()() const { return valid(); @@ -218,7 +223,10 @@ cidr::cidr(const Anope::string &ip, unsigned char len) Anope::string cidr::mask() const { - return Anope::printf("%s/%d", this->cidr_ip.c_str(), this->cidr_len); + if ((this->addr.ipv6() && this->cidr_len == 128) || (!this->addr.ipv6() && this->cidr_len == 32)) + return this->cidr_ip; + else + return Anope::printf("%s/%d", this->cidr_ip.c_str(), this->cidr_len); } bool cidr::match(const sockaddrs &other) |