Don't handle ip without host names in reverse DNS

This commit is contained in:
rdujardin 2016-07-26 11:28:31 +02:00
parent 89a0049532
commit 5282eee5ce

View File

@ -361,6 +361,7 @@ class Prefix(CreatedUpdatedModel):
ipaddresses = IPAddress.objects.filter(family=4) ipaddresses = IPAddress.objects.filter(family=4)
for ip in ipaddresses: for ip in ipaddresses:
if ip.hostname:
ibytes = str(ip.address).split('/')[0].split('.') ibytes = str(ip.address).split('/')[0].split('.')
islash = str(ip.address).split('/')[1] islash = str(ip.address).split('/')[1]
i = netaddr.IPAddress(unicode('.'.join(ibytes))) i = netaddr.IPAddress(unicode('.'.join(ibytes)))
@ -388,6 +389,7 @@ class Prefix(CreatedUpdatedModel):
zslash = pslash if pslash % 16 == 0 else pslash/16+16 zslash = pslash if pslash % 16 == 0 else pslash/16+16
for ip in ipaddresses: for ip in ipaddresses:
if ip.hostname:
ifull = str(ipaddress.IPv6Address(unicode(str(ip.address).split('/')[0])).exploded) ifull = str(ipaddress.IPv6Address(unicode(str(ip.address).split('/')[0])).exploded)
inibbles = ifull.split(':') inibbles = ifull.split(':')
idigits = ifull.replace(':','')[::-1] idigits = ifull.replace(':','')[::-1]