]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/main.cpp
Fix building on Windows.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / main.cpp
index 2fd578698e2151f722117c43080d7a65b5a59858..21251983cd27b7b9a1f0ae50c65525f8759542c5 100644 (file)
@@ -203,7 +203,15 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
                return;
        }
 
-       if (strchr(x->IPAddr.c_str(),':'))
+#ifndef _WIN32
+       if (x->IPAddr.find('/') != std::string::npos)
+       {
+               struct stat sb;
+               if (stat(x->IPAddr.c_str(), &sb) == -1 || !S_ISSOCK(sb.st_mode))
+                       ipvalid = false;
+       }
+#endif
+       if (x->IPAddr.find(':') != std::string::npos)
        {
                in6_addr n;
                if (inet_pton(AF_INET6, x->IPAddr.c_str(), &n) < 1)
@@ -243,7 +251,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
                irc::sockets::sockaddrs bind;
                if ((!x->Bind.empty()) && (irc::sockets::aptosa(x->Bind, 0, bind)))
                {
-                       if (bind.sa.sa_family == AF_INET)
+                       if (bind.family() == AF_INET)
                                start_type = DNS::QUERY_A;
                }