diff options
author | Tom Gundersen <teg@jklm.no> | 2014-02-19 15:59:31 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-02-19 16:46:58 +0100 |
commit | 216816c6bcabd70342593637a55300749a567f5c (patch) | |
tree | e5c5840bf30dba1755d0aa6b2fbeaaf72d61bc3c /src/network | |
parent | 31d5a60cae19025225eda458386e0692bec5eec4 (diff) |
networkd: link - only reset transient hostname if it was set by us
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-link.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 66bcb6bacf..aa23bfbc99 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -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); |