Implement of checking existing higher class ip reverse zones

iteratively checking of existing domains with higher IP
classes. When this function find an existing higher class
domain return with that reverse address. eg. 192.in-addr.arpa

If it is not find  any existing higher class domain it returns with the lowest class domain reverse domain name. eg, 39.168.192.in-addr.arpa
This commit is contained in:
SIPOS, Peter 2016-11-21 19:40:43 +01:00
parent d7db0d5e7a
commit b9f95da906

View File

@ -643,6 +643,19 @@ class Domain(db.Model):
return {'status': 'ok', 'msg': 'New reverse lookup domain created without users'} return {'status': 'ok', 'msg': 'New reverse lookup domain created without users'}
return {'status': 'ok', 'msg': 'Reverse lookup domain already exists'} return {'status': 'ok', 'msg': 'Reverse lookup domain already exists'}
def get_reverse_domain_name(self, reverse_host_address):
if re.search('ip6.arpa', reverse_host_address):
for i in range(31,3,-1):
address = re.search('((([a-f0-9]\.){'+ str(i) +'})(?P<ipname>.+6.arpa)\.?)', reverse_host_address)
if None != self.get_id_by_name(address.group('ipname')):
break
else:
for i in range(3,0,-1):
address = re.search('((([0-9]+\.){'+ str(i) +'})(?P<ipname>.+r.arpa)\.?)', reverse_host_address)
if None != self.get_id_by_name(address.group('ipname')):
break
return address.group('ipname')
def delete(self, domain_name): def delete(self, domain_name):
""" """
Delete a single domain name from powerdns Delete a single domain name from powerdns