Skip to content

Commit

Permalink
Fixes #2222: IP addresses created via the available-ips API endpoint …
Browse files Browse the repository at this point in the history
…should have the same mask as their parent prefix (not /32)
  • Loading branch information
jeremystretch committed Jul 18, 2018
1 parent 6e037e9 commit c257377
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion netbox/ipam/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ def available_ips(self, request, pk=None):

# 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
Expand Down

0 comments on commit c257377

Please sign in to comment.