Commit 0cea7892 by Dudás Ádám

firewall: refactor method implementation

parent ea943848
......@@ -308,13 +308,15 @@ class Vlan(AclBase, models.Model):
ipv4 = str(ipv4)
if ipv4 not in used_v4:
logger.debug("Found unused IPv4 address %s.", ipv4)
if self.network6 is None:
return {'ipv4': ipv4, 'ipv6': None}
else:
ipv6 = None
if self.network6 is not None:
ipv6 = ipv4_2_ipv6(self.ipv6_template, ipv4)
if ipv6 not in used_v6:
if ipv6 in used_v6:
continue
else:
logger.debug("Found unused IPv6 address %s.", ipv6)
return {'ipv4': ipv4, 'ipv6': ipv6}
else:
raise ValidationError(_("All IP addresses are already in use."))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment