Publish DHCP clients' names in DNS
router-webui leases-dns reads Kea's leases and publishes <name>.<domain> with reverse records in the running Unbound (router.dns.dynamicLeases). Names the configuration publishes are never taken over; a client's name is cut to its first label and kept inside the local domain; of two clients the newer lease wins. The DNS page switches it on and shows what is published and what was skipped; router-setup enables it with a domain. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV9dZrK6nipHkPfyM4F
This commit is contained in:
@@ -446,6 +446,7 @@ type Lease struct {
|
||||
Address string
|
||||
MAC string
|
||||
Hostname string
|
||||
Start time.Time // when it was handed out or last renewed
|
||||
Expires time.Time
|
||||
LAN string
|
||||
}
|
||||
@@ -514,6 +515,7 @@ func parseLeases(r io.Reader, latest map[string]Lease, now time.Time) {
|
||||
MAC: get(rec, "hwaddr"),
|
||||
Hostname: strings.ReplaceAll(get(rec, "hostname"), ",", ","),
|
||||
Expires: time.Unix(expire, 0),
|
||||
Start: time.Unix(expire-lifetime, 0),
|
||||
}
|
||||
if lifetime == 0 || (state != "" && state != "0") {
|
||||
l.Expires = time.Time{} // released, declined or reclaimed
|
||||
|
||||
Reference in New Issue
Block a user