diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-06 18:49:47 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-06 18:49:47 +0000 |
commit | 67fb64c5e76ed56be2858c31111ecd00896f8390 (patch) | |
tree | 77687563281af9c3bcdce133fd819f5d9ca1192d /src/modules/m_spanningtree | |
parent | c328ffca4cdb0300e6eee88f91e718ce9ba850ce (diff) |
Make use of new AAAA->A resolving
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6522 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index aa0ff1401..75039840e 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -434,9 +434,30 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime) void ModuleSpanningTree::ConnectServer(Link* x) { - insp_inaddr binip; + bool ipvalid = true; + QueryType start_type = DNS_QUERY_A; +#ifdef IPV6 + start_type = DNS_QUERY_AAAA; + if (strchr(x->IPAddr.c_str(),':')) + { + in6_addr n; + if (inet_pton(AF_INET6, x->IPAddr.c_str(), &n) < 1) + ipvalid = false; + } + else + { + in_addr n; + if (inet_aton(x->IPAddr.c_str(),&n) < 1) + ipvalid = false; + } +#else + in_addr n; + if (inet_aton(x->IPAddr.c_str(),&n) < 1) + ipvalid = false; +#endif + /* Do we already have an IP? If so, no need to resolve it. */ - if (insp_aton(x->IPAddr.c_str(), &binip) > 0) + if (ipvalid) { /* Gave a hook, but it wasnt one we know */ if ((!x->Hook.empty()) && (Utils->hooks.find(x->Hook.c_str()) == Utils->hooks.end())) @@ -458,7 +479,7 @@ void ModuleSpanningTree::ConnectServer(Link* x) try { bool cached; - ServernameResolver* snr = new ServernameResolver((Module*)this, Utils, ServerInstance,x->IPAddr, *x, cached); + ServernameResolver* snr = new ServernameResolver((Module*)this, Utils, ServerInstance,x->IPAddr, *x, cached, start_type); ServerInstance->AddResolver(snr, cached); } catch (ModuleException& e) |