1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixed calculation of last_ip_in_prefix for IPv6

This commit is contained in:
Jeremy Stretch
2016-08-03 12:06:17 -04:00
parent 81d955ab7d
commit 533b4082d8

View File

@ -44,7 +44,7 @@ def add_available_ipaddresses(prefix, ipaddress_list):
first_ip_in_prefix = netaddr.IPAddress(prefix.first)
else:
first_ip_in_prefix = netaddr.IPAddress(prefix.first + 1)
if prefix.version == 4 and prefix.prefixlen == 31:
if prefix.version == 6 or (prefix.version == 4 and prefix.prefixlen == 31):
last_ip_in_prefix = netaddr.IPAddress(prefix.last)
else:
last_ip_in_prefix = netaddr.IPAddress(prefix.last - 1)