summaryrefslogtreecommitdiff
path: root/src/user_resolver.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-01 15:07:11 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-01 15:07:11 +0000
commit5f4095e595fe36c6f83df96b7c59cb459b966ed3 (patch)
tree868b4a7d1f9bfcf3b85d9679fd7cbe48c6cc2005 /src/user_resolver.cpp
parenta64a4665e0a2898ec08cf5996bdbf63c2567310e (diff)
Change IP address storage in User to use more IPv4/IPv6 common code
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11575 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/user_resolver.cpp')
-rw-r--r--src/user_resolver.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/user_resolver.cpp b/src/user_resolver.cpp
index 0213a3cbf..95fa13eaf 100644
--- a/src/user_resolver.cpp
+++ b/src/user_resolver.cpp
@@ -35,11 +35,10 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl,
{
bool lcached = false;
#ifdef IPV6
- if (this->bound_user->GetProtocolFamily() == AF_INET6)
+ if (this->bound_user->ip.sa.sa_family == AF_INET6)
{
- /* IPV6 forward lookup (with possibility of 4in6) */
- const char* ip = this->bound_user->GetIPString();
- res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, (!strncmp(ip, "0::ffff:", 8) ? DNS_QUERY_A : DNS_QUERY_AAAA), lcached);
+ /* IPV6 forward lookup */
+ res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, DNS_QUERY_AAAA, lcached);
}
else
/* IPV4 lookup (mixed protocol mode) */
@@ -60,16 +59,15 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl,
{
/* Both lookups completed */
- sockaddr* user_ip = this->bound_user->ip;
+ irc::sockets::sockaddrs* user_ip = &this->bound_user->ip;
bool rev_match = false;
#ifdef IPV6
- if (user_ip->sa_family == AF_INET6)
+ if (user_ip->sa.sa_family == AF_INET6)
{
struct in6_addr res_bin;
if (inet_pton(AF_INET6, result.c_str(), &res_bin))
{
- sockaddr_in6* user_ip6 = reinterpret_cast<sockaddr_in6*>(user_ip);
- rev_match = !memcmp(&user_ip6->sin6_addr, &res_bin, sizeof(res_bin));
+ rev_match = !memcmp(&user_ip->in6.sin6_addr, &res_bin, sizeof(res_bin));
}
}
else
@@ -78,8 +76,7 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl,
struct in_addr res_bin;
if (inet_pton(AF_INET, result.c_str(), &res_bin))
{
- sockaddr_in* user_ip4 = reinterpret_cast<sockaddr_in*>(user_ip);
- rev_match = !memcmp(&user_ip4->sin_addr, &res_bin, sizeof(res_bin));
+ rev_match = !memcmp(&user_ip->in4.sin_addr, &res_bin, sizeof(res_bin));
}
}