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:
2026-10-30 00:18:01 +01:00
co-authored by Claude Sonnet 5.5
parent 84f6002d05
commit 2eab735f59
13 changed files with 711 additions and 7 deletions
+32
View File
@@ -42,9 +42,41 @@
</table>
<p class="hint">Names below these domains are asked from these resolvers (for example across a tunnel), not from the internet.</p>
</fieldset>
<fieldset>
<legend>DHCP clients</legend>
<label><input type="checkbox" name="dynamic" {{if .Dynamic}}checked{{end}}> Publish the names of DHCP clients as <code>name.{{if .Domain}}{{.Domain}}{{else}}domain{{end}}</code></label>
{{if and .Dynamic (not .Domain)}}<p class="field-error">This needs a local domain (Network page).</p>{{end}}
<p class="hint">A client chooses its own name, so only its first label is used, only in your local domain, and a name
that is configured here (a record above, a reservation, the router itself, a wildcard) is never taken over.
Of two clients with one name the newer lease wins. Takes effect when applied.</p>
</fieldset>
<button>Save</button>
</form>
{{if .Dyn}}
<section>
<h2>DHCP clients in DNS</h2>
{{if .Dyn.Error}}<p class="field-error">The last update failed: {{.Dyn.Error}}</p>{{end}}
{{if .Dyn.Published}}
<table>
<tr><th>Name</th><th>Address</th></tr>
{{range .Dyn.Published}}<tr><td>{{.Name}}</td><td>{{.Address}}</td></tr>{{end}}
</table>
{{else}}<p class="muted">No client names are published at the moment.</p>{{end}}
{{if .Dyn.Skipped}}
<p class="hint">Not published:</p>
<table>
<tr><th>Client name</th><th>Address</th><th>Why</th></tr>
{{range .Dyn.Skipped}}<tr><td>{{.Hostname}}</td><td>{{.Address}}</td><td>{{.Reason}}</td></tr>{{end}}
</table>
{{end}}
<p class="hint">As of {{ago .Dyn.Updated}} ago, from the running configuration.</p>
</section>
{{else if .Dynamic}}
<p class="hint">Client names are not published yet: apply the settings so the service starts.</p>
{{end}}
{{if .Auto}}
<section>
<h2>Published automatically</h2>