[PR #17391] [MERGED] Fixes: #17358 - Ensure correct comparison of overlapping IPRanges #15084

Closed
opened 2025-12-30 00:19:51 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/17391
Author: @bctiemann
Created: 9/5/2024
Status: Merged
Merged: 10/28/2024
Merged by: @jeremystretch

Base: developHead: 17358-new-inet-lookups-overlapping-ipranges


📝 Commits (6)

  • ad3df60 Add new INET lookups for net_host_lt/gt/lte/gte comparisons irrespective of subnet inclusion
  • fcfbb1e Refactor Lookup subclasses to be more DRY
  • d4a910e Move comparison_sql to class attribute
  • 789ca6b Add HostAsInet(Transform) to perform cast
  • 1a1156e Remove unnecessary Lookup comparison classes
  • 66319f9 Chain Host and Inet instead of making a new transform

📊 Changes

3 files changed (+38 additions, -7 deletions)

View changed files

📝 netbox/ipam/fields.py (+2 -0)
📝 netbox/ipam/models/ip.py (+7 -7)
📝 netbox/ipam/tests/test_models.py (+29 -0)

📄 Description

Fixes: #17358

Adds new Lookup classes for lt/gt/lte/gte comparisons with INET objects, ignoring the mask. This enables correct comparison of adjacent IPRanges when looking for overlaps, and prevents acceptance of an invalid new IPRange where the entered start_address and end_address masks do not match the existing ranges.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/17391 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 9/5/2024 **Status:** ✅ Merged **Merged:** 10/28/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `17358-new-inet-lookups-overlapping-ipranges` --- ### 📝 Commits (6) - [`ad3df60`](https://github.com/netbox-community/netbox/commit/ad3df60fdd381a2cd5d6369ba4be40869a8551d7) Add new INET lookups for net_host_lt/gt/lte/gte comparisons irrespective of subnet inclusion - [`fcfbb1e`](https://github.com/netbox-community/netbox/commit/fcfbb1e67f1d0974b729845817fc5fbc39aa3d50) Refactor Lookup subclasses to be more DRY - [`d4a910e`](https://github.com/netbox-community/netbox/commit/d4a910e06a5d9524a1fe7fef1d5f1b27933e96da) Move comparison_sql to class attribute - [`789ca6b`](https://github.com/netbox-community/netbox/commit/789ca6b560b18777ad47898539fcbee7c4cbac26) Add HostAsInet(Transform) to perform cast - [`1a1156e`](https://github.com/netbox-community/netbox/commit/1a1156ebf1058485b8108f8e745054b2c1eabf3d) Remove unnecessary Lookup comparison classes - [`66319f9`](https://github.com/netbox-community/netbox/commit/66319f9cf0ba47d503efe2498a59069342674616) Chain Host and Inet instead of making a new transform ### 📊 Changes **3 files changed** (+38 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `netbox/ipam/fields.py` (+2 -0) 📝 `netbox/ipam/models/ip.py` (+7 -7) 📝 `netbox/ipam/tests/test_models.py` (+29 -0) </details> ### 📄 Description ### Fixes: #17358 Adds new Lookup classes for `lt/gt/lte/gte` comparisons with INET objects, ignoring the mask. This enables correct comparison of adjacent IPRanges when looking for overlaps, and prevents acceptance of an invalid new IPRange where the entered start_address and end_address masks do not match the existing ranges. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:19:51 +01:00
adam closed this issue 2025-12-30 00:19:51 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15084