Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next available IP Address of a /31 prefix #2757

Closed
avolmensky opened this issue Jan 8, 2019 · 0 comments
Closed

Next available IP Address of a /31 prefix #2757

avolmensky opened this issue Jan 8, 2019 · 0 comments
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@avolmensky
Copy link

Environment

  • Python version: 2.7.13
  • NetBox version: 2.5.2

Steps to Reproduce

When requesting next available IP from the API within a prefix that is a /31, an empty list is returned. This is causing issues further down the track with pynetbox not being able to create an IP address in a /31 prefix.

I have tracked this down to line 442 of ipam/models.py https://github.com/digitalocean/netbox/blob/f7f6704fc1956427608c86870f4bd609df0fb8ef/netbox/ipam/models.py#L442
According to RFC3021 first and last address in a /31 is a usable IP Address.

The following changes fix the problem. Should I create a PR for this?

From:

        if not self.is_pool:

To:

        if not self.is_pool and not (self.prefix.prefixlen == 31 and self.family == 4):
@jeremystretch jeremystretch added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation labels Jan 8, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants