Reservation lease time; reservations by MAC address or client ID
- A reservation can have its own lease time (--lease-time, the reservation dialog), over the subnet's. Schema migration 6. - A reservation with a MAC address and a client ID matches either one (a dual-boot machine sends two client IDs from one MAC); before, it was found by MAC and then refused. A lease of the reserved address by the client's other identity counts as its own. - The Leases page shows a client's client ID; reserving a lease uses both, or one with --by / the dialog's choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abb2ee0fd7
commit
4fd72998ec
20 files changed
+252
-65
No files matched your search
@@ -294,14 +294,21 @@ func (c *checker) reservations(st *model.State, env *Env) {
|
||||
c.add(Error, "reservation_ip_taken", obj, "%s is already reserved for %s", r.IP, o.Label())
|
||||
}
|
||||
byIP[r.IP] = r
|
||||
k := key{s.ID, "mac " + r.MAC}
|
||||
if r.ClientID != "" {
|
||||
k.id = "id " + r.ClientID
|
||||
// Either of a client's MAC address and client ID finds its
|
||||
// reservation, so neither may be another's.
|
||||
for _, k := range []key{{s.ID, "mac " + r.MAC}, {s.ID, "id " + r.ClientID}} {
|
||||
if k.id == "mac " || k.id == "id " {
|
||||
continue
|
||||
}
|
||||
if o := byClient[k]; o != nil && o != r {
|
||||
c.add(Error, "reservation_client_taken", obj, "this client already has a reservation in %s: %s", s.Label(), o.Label())
|
||||
break
|
||||
}
|
||||
byClient[k] = r
|
||||
}
|
||||
if o := byClient[k]; o != nil {
|
||||
c.add(Error, "reservation_client_taken", obj, "this client already has a reservation in %s: %s", s.Label(), o.Label())
|
||||
}
|
||||
byClient[k] = r
|
||||
}
|
||||
if r.LeaseTime != 0 {
|
||||
c.leaseTime(r.LeaseTime, obj)
|
||||
}
|
||||
if r.Hostname != "" && !validHostname(r.Hostname) {
|
||||
c.add(Error, "reservation_hostname", obj, "%q isn't a valid host name (letters, digits and '-', labels up to 63 characters, separated by dots)", r.Hostname)
|
||||
|
||||
Reference in new issue
Block a user