Fix #631 Ipv6 reverse dns with pretty_ipv6_ptr enabled

This commit is contained in:
Khanh Ngo 2020-01-03 09:32:04 +07:00
parent 3bf6e6e9f1
commit 7f8ae003fc
No known key found for this signature in database
GPG Key ID: A945965CD6351844

View File

@ -149,12 +149,12 @@ class Record(object):
# If it is ipv6 reverse zone and PRETTY_IPV6_PTR is enabled, # If it is ipv6 reverse zone and PRETTY_IPV6_PTR is enabled,
# We convert ipv6 address back to reverse record format # We convert ipv6 address back to reverse record format
# before submitting to PDNS API. # before submitting to PDNS API.
if self.PRETTY_IPV6_PTR and re.search(r'ip6\.arpa', domain_name): if self.PRETTY_IPV6_PTR and re.search(
if record['record_type'] == 'PTR' and ':' in record[ r'ip6\.arpa', domain_name
) and record['record_type'] == 'PTR' and ':' in record[
'record_name']: 'record_name']:
record_name = dns.reversename.from_address( record_name = dns.reversename.from_address(
record['record_name']).to_text() record['record_name']).to_text()
# Else, it is forward zone, then record name should be # Else, it is forward zone, then record name should be
# in format "<name>.<domain>.". If it is root # in format "<name>.<domain>.". If it is root
# domain name (name == '@' or ''), the name should # domain name (name == '@' or ''), the name should