diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-05 23:25:50 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-05 23:25:50 +0000 |
commit | c91139af8c4360f3ea0f2b79ccd4137bf215effa (patch) | |
tree | 7668d5de618e4690dd888a8aeac71ba2b1696cc1 /src | |
parent | 0234afda2c9899eb8f378b6710ce12c28c546c9c (diff) |
Fix for allowing dns lookups to work in mixed protocol mode
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6504 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/users.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/users.cpp b/src/users.cpp index c3e52c80d..3d92de99a 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -141,7 +141,7 @@ void userrec::StartDNSLookup() try { bool cached; - res_reverse = new UserResolver(this->ServerInstance, this, this->GetIPString(), DNS_QUERY_REVERSE, cached); + res_reverse = new UserResolver(this->ServerInstance, this, this->GetIPString(), this->GetProtocolFamily() == AF_INET ? DNS_QUERY_PTR4 : DNS_QUERY_PTR6, cached); this->ServerInstance->AddResolver(res_reverse, cached); } catch (CoreException& e) @@ -169,9 +169,19 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl, { bool cached; #ifdef IPV6 - const char *ip = this->bound_user->GetIPString(); - bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, (strstr(ip,"0::ffff:") == ip ? DNS_QUERY_A : DNS_QUERY_AAAA), cached); + if (this->bound_user->GetProtocolFamily() == AF_INET6) + { + /* IPV6 forward lookup (with possibility of 4in6) */ + char* ip = this->bound_user->GetIPString(); + bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, (strstr(ip,"0::ffff:") == ip ? DNS_QUERY_A : DNS_QUERY_AAAA), cached); + } + else + { + /* IPV4 lookup (mixed protocol mode) */ + bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, DNS_QUERY_A, cached); + } #else + /* IPV4 lookup (ipv4 only mode) */ bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, DNS_QUERY_A, cached); #endif this->ServerInstance->AddResolver(bound_user->res_forward, cached); |