mirror of
https://github.com/systemd/systemd.git
synced 2025-02-03 17:47:28 +03:00
networkd: link - only reset transient hostname if it was set by us
This commit is contained in:
parent
31d5a60cae
commit
216816c6bc
@ -507,9 +507,14 @@ static int dhcp_lease_lost(Link *link) {
|
||||
}
|
||||
|
||||
if (link->network->dhcp_hostname) {
|
||||
r = set_hostname(link->manager->bus, "");
|
||||
if (r < 0)
|
||||
log_error("Failed to reset transient hostname");
|
||||
const char *hostname = NULL;
|
||||
|
||||
r = sd_dhcp_lease_get_hostname(link->dhcp_lease, &hostname);
|
||||
if (r >= 0 && hostname) {
|
||||
r = set_hostname(link->manager->bus, "");
|
||||
if (r < 0)
|
||||
log_error("Failed to reset transient hostname");
|
||||
}
|
||||
}
|
||||
|
||||
link->dhcp_lease = sd_dhcp_lease_unref(link->dhcp_lease);
|
||||
|
Loading…
x
Reference in New Issue
Block a user