diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dns.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index ac6097cd2..ea6b000a9 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -291,7 +291,6 @@ int DNS::PruneCache() void DNS::Rehash() { - insp_inaddr addr; ip6munge = false; if (this->GetFd() > -1) @@ -319,6 +318,19 @@ void DNS::Rehash() this->ip6munge = true; } + this->socketfamily = AF_INET; +#ifdef IPV6 + if (strchr(ServerInstance->Config->DNSServer,':')) + { + this->socketfamily = AF_INET6; + inet_pton(AF_INET6, &this->myserver6, ServerInstance->Config->DNSServer); + } + else + inet_aton(&this->myserver4, ServerInstance->Config->DNSServer); +#else + inet_aton(&this->myserver4, ServerInstance->Config->DNSServer); +#endif + /* Initialize mastersocket */ int s = OpenTCPSocket(ServerInstance->Config->DNSServer, SOCK_DGRAM); this->SetFd(s); |