mirror of
https://github.com/systemd/systemd.git
synced 2026-11-07 22:07:14 +00:00
networkd reads the system hostname only once, when the DHCP client is configured. After the hostname is changed, e.g. with 'hostnamectl hostname', the old name is still sent on lease renewal until the interface is reconfigured. This makes networkd watch /proc/sys/kernel/hostname, like resolved does, and update the hostname in running DHCPv4 and DHCPv6 clients. The new name is sent with the next renewal; no extra request is triggered. Interfaces with an explicit Hostname= are not affected. To allow this, sd-dhcp-client and sd-dhcp6-client no longer refuse changing the hostname/FQDN while the client is running, as it is only used when building messages. Tested with dnsmasq: before the change the renewal REQUEST still carried the old name, after it the new one. Fixes #36440. Fixes #36792.