summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-03 16:27:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-03 16:27:16 +0000
commit73fda5d362f0dd7b9550badf364330b2fd4810db (patch)
treeea08b5b15fda900711edabf0c67d24225b8a0d1a /src
parent98d0bbfbb0128ca7a3209b98abe450a83a7223e2 (diff)
*.ip6.int PTR lookups. FUGLY AS FUCK. someone please help me tidy (backported from firedns)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4676 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/dns.cpp46
1 files changed, 40 insertions, 6 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index 3db0c2486..ae0e203cd 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -399,17 +399,52 @@ int DNS::GetCName(const char *alias)
/* Start lookup of an IP address to a hostname */
int DNS::GetName(const insp_inaddr *ip)
{
-#ifdef IPV6
- return -1;
-#else
char query[29];
DNSHeader h;
int id;
int length;
+#ifdef IPV6
+ /* XXX: This SUCKS. and i mean REALLY, REALLY sucks. Anyone who rewrites it pretty gets a cookie. */
+ sprintf(query,"%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.ip6.int",
+ ip->s6_addr[15] & 0x0f,
+ (ip->s6_addr[15] & 0xf0) >> 4,
+ ip->s6_addr[14] & 0x0f,
+ (ip->s6_addr[14] & 0xf0) >> 4,
+ ip->s6_addr[13] & 0x0f,
+ (ip->s6_addr[13] & 0xf0) >> 4,
+ ip->s6_addr[12] & 0x0f,
+ (ip->s6_addr[12] & 0xf0) >> 4,
+ ip->s6_addr[11] & 0x0f,
+ (ip->s6_addr[11] & 0xf0) >> 4,
+ ip->s6_addr[10] & 0x0f,
+ (ip->s6_addr[10] & 0xf0) >> 4,
+ ip->s6_addr[9] & 0x0f,
+ (ip->s6_addr[9] & 0xf0) >> 4,
+ ip->s6_addr[8] & 0x0f,
+ (ip->s6_addr[8] & 0xf0) >> 4,
+ ip->s6_addr[7] & 0x0f,
+ (ip->s6_addr[7] & 0xf0) >> 4,
+ ip->s6_addr[6] & 0x0f,
+ (ip->s6_addr[6] & 0xf0) >> 4,
+ ip->s6_addr[5] & 0x0f,
+ (ip->s6_addr[5] & 0xf0) >> 4,
+ ip->s6_addr[4] & 0x0f,
+ (ip->s6_addr[4] & 0xf0) >> 4,
+ ip->s6_addr[3] & 0x0f,
+ (ip->s6_addr[3] & 0xf0) >> 4,
+ ip->s6_addr[2] & 0x0f,
+ (ip->s6_addr[2] & 0xf0) >> 4,
+ ip->s6_addr[1] & 0x0f,
+ (ip->s6_addr[1] & 0xf0) >> 4,
+ ip->s6_addr[0] & 0x0f,
+ (ip->s6_addr[0] & 0xf0) >> 4
+ );
+#else
unsigned char* c = (unsigned char*)&ip->s_addr;
sprintf(query,"%d.%d.%d.%d.in-addr.arpa",c[3],c[2],c[1],c[0]);
+#endif
if ((length = this->MakePayload(query, DNS_QUERY_PTR, 1, (unsigned char*)&h.payload)) == -1)
return -1;
@@ -420,7 +455,6 @@ int DNS::GetName(const insp_inaddr *ip)
return -1;
return id;
-#endif
}
/* Return the next id which is ready, and the result attached to it */
@@ -718,10 +752,10 @@ Resolver::Resolver(const std::string &source, QueryType qt) : input(source), que
break;
case DNS_QUERY_PTR:
- if (insp_aton(source.c_str(), &binip) > 0)
+ if (insp_aton(source.c_str(), &binip) > 0)
{
/* Valid ip address */
- this->myid = ServerInstance->Res->GetName(&binip);
+ this->myid = ServerInstance->Res->GetName(&binip);
}
else
{