Address order: sequential, reverse or random, per subnet and pool
- Which never-used pool address a new client gets: sequential (the lowest, as before), reverse or random, in the settings, a subnet or a single pool (FIRST-LAST:ORDER). When no never-used address is left, the one free the longest, whatever the order; returning clients keep theirs. - A subnet's pools are used in the order listed, or one at random weighted by its never-used addresses. Pools now keep the order they are given in (no more sorting by address). - CLI --address-order and --pool-order; --add-pool of an existing range changes its order in place. Web UI: per-pool order and a move-up button, pool and address order on the subnet and settings pages. - Kea's allocator: random is imported. Schema migration 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
29fc991ce1
commit
8ee430276c
29 files changed
+653
-79
No files matched your search
@@ -168,3 +168,24 @@ func TestParseLeases(t *testing.T) {
|
||||
t.Error("a file without Kea's columns was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAllocator(t *testing.T) {
|
||||
cfg := `{"Dhcp4": {"allocator": "random", "subnet4": [
|
||||
{"subnet": "192.168.5.0/24", "interface": "eth0", "pools": [{"pool": "192.168.5.10-192.168.5.20"}]},
|
||||
{"subnet": "192.168.6.0/24", "interface": "eth1", "allocator": "iterative", "pools": [{"pool": "192.168.6.10-192.168.6.20"}]}]}}`
|
||||
res, err := ParseConfig([]byte(cfg), Options{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if s := res.State.Subnets[0]; s.PoolOrder != model.PoolsRandom || s.AddressOrder != model.OrderRandom {
|
||||
t.Errorf("random: %+v", s)
|
||||
}
|
||||
if s := res.State.Subnets[1]; s.PoolOrder != "" || s.AddressOrder != "" {
|
||||
t.Errorf("iterative: %+v", s)
|
||||
}
|
||||
for _, sk := range res.Skipped {
|
||||
if strings.Contains(sk, "allocator") {
|
||||
t.Errorf("skipped %q", sk)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user