Merge pull request #12874 from ITJamie/broadcast_exceptions

assigning broadcast ip error fixes for ipv6 and /31/32
This commit is contained in:
Jeremy Stretch 2023-06-13 08:57:32 -04:00 committed by GitHub
commit 74c1f7a176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -370,7 +370,7 @@ class IPAddressForm(TenancyForm, NetBoxModelForm):
raise ValidationError(msg)
if address.version == 6 and address.prefixlen not in (127, 128):
raise ValidationError(msg)
if address.ip == address.broadcast:
if address.version == 4 and address.ip == address.broadcast and address.prefixlen not in (31, 32):
msg = f"{address} is a broadcast address, which may not be assigned to an interface."
raise ValidationError(msg)