From 78d6561e3928e2d221044cf3fb1096e16437f398 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 24 Aug 2020 10:51:47 -0400 Subject: [PATCH] Fixes #5040: Limit SLAAC status to IPv6 addresses --- docs/release-notes/version-2.9.md | 1 + netbox/ipam/models.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 2683e85cf..54bd5a84d 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -6,6 +6,7 @@ * [#5035](https://github.com/netbox-community/netbox/issues/5035) - Fix exception when modifying an IP address assigned to a VM * [#5038](https://github.com/netbox-community/netbox/issues/5038) - Fix validation of primary IPs assigned to virtual machines +* [#5040](https://github.com/netbox-community/netbox/issues/5040) - Limit SLAAC status to IPv6 addresses * [#5042](https://github.com/netbox-community/netbox/issues/5042) - Fix display of SLAAC label for IP addresses status --- diff --git a/netbox/ipam/models.py b/netbox/ipam/models.py index 2aeee30fc..832e09330 100644 --- a/netbox/ipam/models.py +++ b/netbox/ipam/models.py @@ -752,6 +752,12 @@ class IPAddress(ChangeLoggedModel, CustomFieldModel): f"{self.assigned_object.virtual_machine} ({self.assigned_object})" }) + # Validate IP status selection + if self.status == IPAddressStatusChoices.STATUS_SLAAC and self.family != 6: + raise ValidationError({ + 'status': "Only IPv6 addresses can be assigned SLAAC status" + }) + def save(self, *args, **kwargs): # Force dns_name to lowercase