- // Fix: Only trip autoconnects if this wouldn't delay autoconnect..
- if (L.NextConnectTime > ((time_t)(ServerInstance->Time() + L.AutoConnect)))
- L.NextConnectTime = ServerInstance->Time() + L.AutoConnect;
-
- if (L.Name.find('.') == std::string::npos)
- throw CoreException("The link name '"+assign(L.Name)+"' is invalid and must contain at least one '.' character");
-
- if (L.Name.length() > 64)
- throw CoreException("The link name '"+assign(L.Name)+"' is longer than 64 characters!");
-
- if ((!L.IPAddr.empty()) && (!L.RecvPass.empty()) && (!L.SendPass.empty()) && (!L.Name.empty()) && (L.Port))
- {
- if (Allow.length())
- ValidIPs.push_back(Allow);
-
- ValidIPs.push_back(L.IPAddr);
-
- /* Needs resolving */
- bool ipvalid = true;
- QueryType start_type = DNS_QUERY_A;
-#ifdef IPV6
- start_type = DNS_QUERY_AAAA;
- if (strchr(L.IPAddr.c_str(),':'))
- {
- in6_addr n;
- if (inet_pton(AF_INET6, L.IPAddr.c_str(), &n) < 1)
- ipvalid = false;
- }
- else
- {
- in_addr n;
- if (inet_aton(L.IPAddr.c_str(),&n) < 1)
- ipvalid = false;
- }
-#else
- in_addr n;
- if (inet_aton(L.IPAddr.c_str(),&n) < 1)
- ipvalid = false;
-#endif
-
- if (!ipvalid)
- {
- try
- {
- bool cached;
- SecurityIPResolver* sr = new SecurityIPResolver((Module*)this->Creator, this, ServerInstance, L.IPAddr, L, cached, start_type);
- ServerInstance->AddResolver(sr, cached);
- }
- catch (...)
- {
- }
- }
- }
- else
- {
- if (L.IPAddr.empty())
- {
- L.IPAddr = "*";
- ValidIPs.push_back("*");
- ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Configuration warning: Link block " + assign(L.Name) + " has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want.");
- }
-
- if (L.RecvPass.empty())
- {
- throw CoreException("Invalid configuration for server '"+assign(L.Name)+"', recvpass not defined!");
- }
-
- if (L.SendPass.empty())
- {
- throw CoreException("Invalid configuration for server '"+assign(L.Name)+"', sendpass not defined!");
- }
-
- if (L.Name.empty())
- {
- throw CoreException("Invalid configuration, link tag without a name! IP address: "+L.IPAddr);
- }
-
- if (!L.Port)
- {
- ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Configuration warning: Link block " + assign(L.Name) + " has no port defined, you will not be able to /connect it.");
- }
- }