From 754f0130893bacb2b69a32c3de9ed1b3da9659cd Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 19 Jan 2016 15:39:14 -0500 Subject: spanningtree: use bindip aftype as a hint for dns lookup type --- src/modules/m_spanningtree/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index f26b3c828..fda420434 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -200,7 +200,6 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) return; } - DNS::QueryType start_type = DNS::QUERY_AAAA; if (strchr(x->IPAddr.c_str(),':')) { in6_addr n; @@ -236,6 +235,15 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) } else { + // Guess start_type from bindip aftype + DNS::QueryType start_type = DNS::QUERY_AAAA; + irc::sockets::sockaddrs bind; + if ((!x->Bind.empty()) && (irc::sockets::aptosa(x->Bind, 0, bind))) + { + if (bind.sa.sa_family == AF_INET) + start_type = DNS::QUERY_A; + } + ServernameResolver* snr = new ServernameResolver(*DNS, x->IPAddr, x, start_type, y); try { -- cgit v1.2.3