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
@@ -118,6 +118,9 @@ func (s *Server) updateSettings(w http.ResponseWriter, r *http.Request, p *auth.
|
||||
if in.NotAuthoritative != nil {
|
||||
set.NotAuthoritative = *in.NotAuthoritative
|
||||
}
|
||||
if in.AddressOrder != nil {
|
||||
set.AddressOrder = orderInput(*in.AddressOrder)
|
||||
}
|
||||
return nil
|
||||
}, func(st *model.State) any { return st.Settings })
|
||||
}
|
||||
@@ -194,6 +197,16 @@ func (s *Server) getSubnet(w http.ResponseWriter, r *http.Request, p *auth.Princ
|
||||
return nil
|
||||
}
|
||||
|
||||
// orderInput reads an address or pool order: "default" is "" (inherited,
|
||||
// or the default); validation checks the rest.
|
||||
func orderInput(s string) string {
|
||||
s = strings.ToLower(strings.TrimSpace(s))
|
||||
if s == "default" {
|
||||
return ""
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// applySubnetInput sets the given fields.
|
||||
func applySubnetInput(sn *model.Subnet, in *api.SubnetInput) error {
|
||||
if in.Name != nil {
|
||||
@@ -219,6 +232,12 @@ func applySubnetInput(sn *model.Subnet, in *api.SubnetInput) error {
|
||||
sn.Pools = append(sn.Pools, pool)
|
||||
}
|
||||
}
|
||||
if in.PoolOrder != nil {
|
||||
sn.PoolOrder = orderInput(*in.PoolOrder)
|
||||
}
|
||||
if in.AddressOrder != nil {
|
||||
sn.AddressOrder = orderInput(*in.AddressOrder)
|
||||
}
|
||||
if in.LeaseTime != nil {
|
||||
sn.LeaseTime = *in.LeaseTime
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user