From 98d0bbfbb0128ca7a3209b98abe450a83a7223e2 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 3 Aug 2006 16:17:54 +0000 Subject: 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 --- src/dns.cpp | 18 ++++++++---------- 1 file 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) { -- cgit v1.2.3