]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Allow multiple allowmasks in link blocks, #679
authorAdam <Adam@anope.org>
Thu, 21 Nov 2013 20:52:38 +0000 (15:52 -0500)
committerAdam <Adam@anope.org>
Thu, 21 Nov 2013 20:52:38 +0000 (15:52 -0500)
docs/conf/links.conf.example
src/modules/m_spanningtree/link.h
src/modules/m_spanningtree/utils.cpp

index 382455bcd1672ea0c9c67f1ed226486b2b195ff5..b196c5621002b76a6daab6371c6a28132e3e8a60 100644 (file)
@@ -29,7 +29,7 @@
 
       # allowmask: Range of IP addresses to allow for this link.
       # Can be a CIDR (see example).
-      allowmask="69.58.44.0/24"
+      allowmask="69.58.44.0/24 127.0.0.0/8"
 
       # timeout: If defined, this option defines how long the server
       # will wait to consider the connect attempt failed and try the
index b318c9bf2d65b2ab3ad564db5bdb00cfa45eb316..21213fb3e9e490a20253e032dd56d3595752d7de 100644 (file)
@@ -30,7 +30,7 @@ class Link : public refcountbase
        std::string SendPass;
        std::string RecvPass;
        std::string Fingerprint;
-       std::string AllowMask;
+       std::vector<std::string> AllowMasks;
        bool HiddenFromStats;
        std::string Hook;
        int Timeout;
index 6c3ee703c144f872b4940ee4706b8a1e4014e169..c9abbd0084ba4afd1dc98ff8f10faa3538a90426 100644 (file)
@@ -227,8 +227,7 @@ void SpanningTreeUtilities::RefreshIPCache()
                        continue;
                }
 
-               if (L->AllowMask.length())
-                       ValidIPs.push_back(L->AllowMask);
+               std::copy(L->AllowMasks.begin(), L->AllowMasks.end(), std::back_inserter(ValidIPs));
 
                irc::sockets::sockaddrs dummy;
                bool ipvalid = irc::sockets::aptosa(L->IPAddr, L->Port, dummy);
@@ -277,7 +276,11 @@ void SpanningTreeUtilities::ReadConfiguration()
                reference<Link> L = new Link(tag);
                std::string linkname = tag->getString("name");
                L->Name = linkname.c_str();
-               L->AllowMask = tag->getString("allowmask");
+
+               irc::spacesepstream sep = tag->getString("allowmask");
+               for (std::string s; sep.GetToken(s);)
+                       L->AllowMasks.push_back(s);
+
                L->IPAddr = tag->getString("ipaddr");
                L->Port = tag->getInt("port");
                L->SendPass = tag->getString("sendpass", tag->getString("password"));