summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-05 23:51:03 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-05 23:51:03 +0000
commitacd24151ceaa6d01655ae39470111adae3a4fba4 (patch)
tree82f12a6543ee424998b2a1b49dde346cad387322
parent49369545e34e9d16d53c6c62eb8659a590af62ed (diff)
This wont compile atm
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6507 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/dns.h6
-rw-r--r--src/dns.cpp14
2 files changed, 18 insertions, 2 deletions
diff --git a/include/dns.h b/include/dns.h
index 6913527ae..54cdf5672 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -337,7 +337,11 @@ class DNS : public EventHandler
/**
* Server address being used currently
*/
- insp_inaddr myserver;
+ int socketfamily;
+#ifdef IPV6
+ in6_addr myserver6;
+#endif
+ in_addr myserver4;
/**
* A counter used to form part of the pseudo-random id
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);