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'):
+ best_domain = name # Act authoritative for the IP address for reverse resolution requests
+ else:
+ return defer.fail(failure.Failure(dns.DomainError(name)))
domain = best_domain
results = []
authority = []
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,