Skip to content

Commit 3c47932

Browse files
[subnet_division] Fixed overlapping subnets with different sizes #864
Refactored the allocation logic to use netaddr.IPSet for mathematical gap-filling. Added a guard for /32 rules on /32 master subnets and restored the exhaustion logger expected by legacy tests. Fixes #864
1 parent cb38242 commit 3c47932

File tree

1 file changed

+2
-1
lines changed
  • openwisp_controller/subnet_division/rule_types

1 file changed

+2
-1
lines changed

openwisp_controller/subnet_division/rule_types/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
SubnetDivisionIndex = load_model("subnet_division", "SubnetDivisionIndex")
2121
VpnClient = load_model("config", "VpnClient")
2222

23+
2324
class BaseSubnetDivisionRuleType(object):
2425
provision_signal = None
2526
provision_sender = None
@@ -142,7 +143,7 @@ def get_config(cls, instance):
142143
@staticmethod
143144
def get_max_subnet(master_subnet, division_rule):
144145
master_network = IPNetwork(str(master_subnet.subnet))
145-
146+
146147
if not Subnet.objects.filter(master_subnet_id=master_subnet.id).exists():
147148
first_candidate = next(master_network.subnet(prefixlen=division_rule.size))
148149
if division_rule.size > master_network.prefixlen:

0 commit comments

Comments
 (0)