mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-26 14:42:25 +00:00
Merge branch 'fix_ipv6_clean_from_dev_is_better' into 'dev'
Prevents from crashing where there is no defined prefix_v6 See merge request federez/re2o!384
This commit is contained in:
commit
67445717ea
1 changed files with 4 additions and 1 deletions
|
@ -1380,7 +1380,10 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
||||||
.filter(interface=self.interface, slaac_ip=True)
|
.filter(interface=self.interface, slaac_ip=True)
|
||||||
.exclude(id=self.id)):
|
.exclude(id=self.id)):
|
||||||
raise ValidationError(_("A SLAAC IP address is already registered."))
|
raise ValidationError(_("A SLAAC IP address is already registered."))
|
||||||
|
try:
|
||||||
prefix_v6 = self.interface.type.ip_type.prefix_v6.encode().decode('utf-8')
|
prefix_v6 = self.interface.type.ip_type.prefix_v6.encode().decode('utf-8')
|
||||||
|
except AttributeError: # Prevents from crashing when there is no defined prefix_v6
|
||||||
|
prefix_v6 = None
|
||||||
if prefix_v6:
|
if prefix_v6:
|
||||||
if (IPv6Address(self.ipv6.encode().decode('utf-8')).exploded[:20] !=
|
if (IPv6Address(self.ipv6.encode().decode('utf-8')).exploded[:20] !=
|
||||||
IPv6Address(prefix_v6).exploded[:20]):
|
IPv6Address(prefix_v6).exploded[:20]):
|
||||||
|
|
Loading…
Reference in a new issue