sd-dhcp-server: Add Hostname= option to static leases

This adds a new `Hostname=` option to the [DHCPServerStaticLease]
section in .network files, allowing an administrator to assign a
specific hostname to a client receiving a static lease.

We automatically select the correct DHCP option to use based on the
format of the provided string:

- Single DNS labels are sent as Option 12.
- Names with multiple DNS labels are sent as Option 81 in wire format.

Fixes: #39634
This commit is contained in:
Chris Down
2025-11-14 07:50:13 +09:00
committed by Yu Watanabe
parent c83f3f0837
commit 7f9c0c31d2
18 changed files with 409 additions and 36 deletions
@@ -16,10 +16,12 @@ DNS=9.9.9.9
[DHCPServerStaticLease]
MACAddress=12:34:56:78:9a:bc
Address=10.1.1.2
Hostname=testhost
[DHCPServerStaticLease]
MACAddress=12:34:56:78:9a:bc
Address=10.1.1.3
Hostname=device.example.com
[DHCPServerStaticLease]
Address=10.1.1.4