]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-dhcp-server: Add Hostname= option to static leases
authorChris Down <chris@chrisdown.name>
Sun, 9 Nov 2025 16:59:59 +0000 (00:59 +0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Nov 2025 22:50:13 +0000 (07:50 +0900)
commit7f9c0c31d2f00f472c361868ac2184d77113db72
tree7d191ac7e21450e700c6e9651ec783e00b1d1c5a
parentc83f3f08372ff7937b6cbc2de0b273de10022a8e
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
18 files changed:
man/systemd.network.xml
src/libsystemd-network/fuzz-dhcp-server.c
src/libsystemd-network/sd-dhcp-lease.c
src/libsystemd-network/sd-dhcp-server-lease.c
src/libsystemd-network/sd-dhcp-server.c
src/libsystemd-network/test-dhcp-server.c
src/network/networkd-dhcp-server-static-lease.c
src/network/networkd-dhcp-server-static-lease.h
src/network/networkd-dhcp-server.c
src/network/networkd-json.c
src/network/networkd-network-gperf.gperf
src/shared/varlink-io.systemd.Network.c
src/systemd/sd-dhcp-server.h
test/fuzz/fuzz-network-parser/dhcp-server-static-lease
test/test-network/conf/25-dhcp-client-fqdn-hostname.network [new file with mode: 0644]
test/test-network/conf/25-dhcp-client-simple-hostname.network [new file with mode: 0644]
test/test-network/conf/25-dhcp-server-static-hostname.network [new file with mode: 0644]
test/test-network/systemd-networkd-tests.py