Overlapping IPRanges are accepted if prefix lengths are different #17358
Labels
netbox
severity: low
Does not significantly disrupt application functionality, or a workaround is available
status: accepted
This issue has been accepted for implementation
type: bug
A confirmed report of unexpected behavior in the application
Deployment Type
Self-hosted
NetBox Version
v4.0.11
Python Version
3.12
Steps to Reproduce
Expected Behavior
The second IPRange should be rejected, as it overlaps with the first. (There is code in
IPRange.clean()
which is clearly intended to do this)Observed Behavior
The overlapping range is accepted.
The problem occurs because the Django ORM lte/gte filter for overlapping ranges only works if the prefix lengths match:
I cannot see an obvious solution here, apart from brute force iterating over all possible prefix lengths:
Alternatively, changing the data model so that a range uses IPAddress instead of IPNetwork for the start/end addresses would eliminate this problem.
The text was updated successfully, but these errors were encountered: