Slapformat: IPv6 range for partitions and tun
Introduce two new features in slapformat:
-
IPv6 ranges for partitions (option
partition_has_ipv6_range): give each partition a /N+16` IPv6 subrange -
IPv6 ranges for tuns (option
tun_ipv6): give each tun a /N+16` IPv6 subrange
Both options are true by default (but tun_ipv6only applies if create_tun is true).
It also changes the way IPv6 ranges and addresses are attributed : instead of a purely random selection with retry if the selected address or range is already taken, a deterministic mapping based on the partition index is first attempted, with a fallback to the previous random retry mechanism in case of collision (which only happens if some addresses or ranges are attributed without using the mapping, e.g. on a existing node).
The deterministic mapping works as such:
The top level /N IPv6 range is first divided into 4 /N+2 subsets numbered 0..3, and each is then divided into 2^14 /N+2+14 subranges, i.e. /N+16. Then:
- IPv6 range for partition
i: subrangeiof subset1 - Tap range for partition
i: subrangeiof subset2 - Tun range for partition
i: subrangeiof subset3
Along the way make some minor improvements, fixes and refactors.