X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-dns.git/blobdiff_plain/315b4edba2429215533e09f5dc8149fa678dfc67..43d2eb55ed8a00a97e806f42ee2f3fdb6a109839:/invirt-dns?ds=sidebyside diff --git a/invirt-dns b/invirt-dns index d6d072e..32b18c2 100755 --- a/invirt-dns +++ b/invirt-dns @@ -63,14 +63,17 @@ class DatabaseAuthority(common.ResolverBase): if name in self.domains: domain = name else: - # Look for the longest-matching domain. (This works because domain - # will remain bound after breaking out of the loop.) + # Look for the longest-matching domain. best_domain = '' for domain in self.domains: if name.endswith('.'+domain) and len(domain) > len(best_domain): best_domain = domain if best_domain == '': - return defer.fail(failure.Failure(dns.DomainError(name))) + if name.endswith('.in-addr.arpa'): + # Act authoritative for the IP address for reverse resolution requests + best_domain = name + else: + return defer.fail(failure.Failure(dns.DomainError(name))) domain = best_domain results = [] authority = [] @@ -80,7 +83,7 @@ class DatabaseAuthority(common.ResolverBase): if cls == dns.IN: host = name[:-len(domain)-1] - if not host: # Request for the domain itself. + if not host and type != dns.PTR: # Request for the domain itself. if type in (dns.A, dns.ALL_RECORDS): record = dns.Record_A(config.dns.nameservers[0].ip, ttl) results.append(dns.RRHeader(name, dns.A, dns.IN,