unioslo/mreg

When reserved adresses are in use, unused_count will subtract them twice

Closed this issue · 0 comments

As long as the code in models.py is setup like this:

# subtract reserved addresses
result -= len(self.get_reserved_ipaddresses())
# subtract used addresses
result -= len(self.used_addresses)

it will always count reserved IP addresses twice, when they are also in use, which in turn while lead to situations where for example mreg returns that there are -2 unused IPs, because you have 3 reserved IPs (that are in use) and a single unused IP address.