diff options
-rw-r--r-- | include/dns.h | 8 | ||||
-rw-r--r-- | src/dns.cpp | 15 |
2 files changed, 18 insertions, 5 deletions
diff --git a/include/dns.h b/include/dns.h index 93817e66f..f66d2d3c4 100644 --- a/include/dns.h +++ b/include/dns.h @@ -249,6 +249,14 @@ class DNS : public Extensible Resolver* Classes[MAX_REQUEST_ID]; /** + * We have to turn off a few checks on received packets + * when people are using 4in6 (e.g. ::ffff:xxxx). This is + * a temporary kludge, Please let me know if you know how + * to fix it. + */ + bool ip6munge; + + /** * Build a dns packet payload */ int MakePayload(const char* name, const QueryType rr, const unsigned short rr_class, unsigned char* payload); diff --git a/src/dns.cpp b/src/dns.cpp index 907ded7f2..42db21424 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -257,11 +257,16 @@ DNS::DNS() if (insp_aton(Config->DNSServer,&addr) > 0) { memcpy(&myserver,&addr,sizeof(insp_inaddr)); - if (strstr(Config->DNSServer,"::ffff:") == (char*)&Config->DNSServer) + if ((strstr(Config->DNSServer,"::ffff:") == (char*)&Config->DNSServer) || (strstr(Config->DNSServer,"::FFFF:") == (char*)&Config->DNSServer)) { - /* These dont come back looking like they did when they went in. Reformat them */ - log(DEBUG,"Munging dns server name"); - strcpy(Config->DNSServer,insp_ntoa(myserver)); + /* These dont come back looking like they did when they went in. + * We're forced to turn some checks off. + * If anyone knows how to fix this, let me know. --Brain + */ + log(DEFAULT,"WARNING: Using IPv4 addresses over IPv6 forces some DNS checks to be disabled."); + log(DEFAULT," This should not cause a problem, however it is recommended you migrate"); + log(DEFAULT," to a true IPv6 environment."); + this->ip6munge = true; } log(DEBUG,"Added nameserver '%s'",Config->DNSServer); } @@ -547,7 +552,7 @@ DNSResult DNS::GetResult() /* We cant perform this security check if you're using 4in6. * Tough luck to you, choose one or't other! */ - if (strstr(Config->DNSServer,"::ffff:") != (char*)&Config->DNSServer) + if (!ip6munge) { if ((port_from != DNS::QUERY_PORT) || (strcasecmp(ipaddr_from, Config->DNSServer))) { |