openwisp / openwisp-controller

Network and WiFi controller: provisioning, configuration management and updates, (pull via openwisp-config or push via SSH), x509 PKI management and more. Mainly OpenWRT, but designed to work also on other systems.
https://openwisp.io/docs/dev/controller/
Other
550 stars 173 forks source link

[bug] Multiple SubnetDivisionRule of different sizes #864

Open pandafy opened 3 months ago

pandafy commented 3 months ago

Steps to replicate

  1. Ensure you have at least one device for the default organization in OpenWISP
  2. Create a subnet 10.0.0.0/16
  3. Add a SubnetDivisionRule as follows: Label: DEV1 Type: Device Organization: Default Size of subnet: 31 Number of subnet: 1 Number of IPs: 1
  4. Ensure that subnets and IPs are created for the exsiting device
  5. Add another SubnetDivisionRule as follows: Label: DEV2 Type: Device Organization: Default Size of subnet: 29 Number of subnet: 1 Number of IPs : 8

Expected Outcome

IPs and Subnets are provisioned for the device according to the DEV2 subnet divison rule.

Actual Outcome

Only IPs and Subnets are created for DEV1

Note: Both the subnet division rules are created for the same subnet

pandafy commented 3 months ago

I suspect this occurs because of the Reserved Subnet. The size of the reserve subnet is dictating the size of the subsequent subnets.

If we change the order of created of subnet division rules, i.e. create DEV2 before DEV1, then the subnet created for DEV1 would be /29 instead of /31