diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-03 16:17:54 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-03 16:17:54 +0000 |
commit | 98d0bbfbb0128ca7a3209b98abe450a83a7223e2 (patch) | |
tree | 88647f85fca52182f5f0bda5ef988dd1cb91053a /src/dns.cpp | |
parent | 9e0fd68e34beeb5b6234fdbe2b70351bf781debe (diff) |
AAAA lookup fixed. Theyre returned as string, without need for inet_pton with an in6_addr, so that its possible to resolve ipv6 without an ipv6 supporting kernel ;)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4675 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dns.cpp')
-rw-r--r-- | src/dns.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index 2980a2502..3db0c2486 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -519,17 +519,15 @@ DNSResult DNS::GetResult() case DNS_QUERY_AAAA: { - in6_addr* ip = (in6_addr*)&data.first; - snprintf(formatted,40,"%x:%x:%x:%x:%x:%x:%x:%x", - ntohs(*((unsigned short *)&ip->s6_addr[0])), - ntohs(*((unsigned short *)&ip->s6_addr[2])), - ntohs(*((unsigned short *)&ip->s6_addr[4])), - ntohs(*((unsigned short *)&ip->s6_addr[6])), - ntohs(*((unsigned short *)&ip->s6_addr[8])), - ntohs(*((unsigned short *)&ip->s6_addr[10])), - ntohs(*((unsigned short *)&ip->s6_addr[12])), - ntohs(*((unsigned short *)&ip->s6_addr[14]))); + (ntohs(data.first[0]) + ntohs(data.first[1] << 8)), + (ntohs(data.first[2]) + ntohs(data.first[3] << 8)), + (ntohs(data.first[4]) + ntohs(data.first[5] << 8)), + (ntohs(data.first[6]) + ntohs(data.first[7] << 8)), + (ntohs(data.first[8]) + ntohs(data.first[9] << 8)), + (ntohs(data.first[10]) + ntohs(data.first[11] << 8)), + (ntohs(data.first[12]) + ntohs(data.first[13] << 8)), + (ntohs(data.first[14]) + ntohs(data.first[15] << 8))); char* c = strstr(formatted,":0:"); if (c != NULL) { |