mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fixes #2222: IP addresses created via the available-ips API endpoint should have the same mask as their parent prefix (not /32)
This commit is contained in:
parent
6e037e91d3
commit
c2573774bf
@ -196,8 +196,9 @@ class PrefixViewSet(CustomFieldModelViewSet):
|
||||
|
||||
# Assign addresses from the list of available IPs and copy VRF assignment from the parent prefix
|
||||
available_ips = iter(available_ips)
|
||||
prefix_length = prefix.prefix.prefixlen
|
||||
for requested_ip in requested_ips:
|
||||
requested_ip['address'] = next(available_ips)
|
||||
requested_ip['address'] = '{}/{}'.format(next(available_ips), prefix_length)
|
||||
requested_ip['vrf'] = prefix.vrf.pk if prefix.vrf else None
|
||||
|
||||
# Initialize the serializer with a list or a single object depending on what was requested
|
||||
|
Loading…
Reference in New Issue
Block a user