summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-19 15:59:31 +0100
committerTom Gundersen <teg@jklm.no>2014-02-19 16:46:58 +0100
commit216816c6bcabd70342593637a55300749a567f5c (patch)
treee5c5840bf30dba1755d0aa6b2fbeaaf72d61bc3c /src/network/networkd-link.c
parent31d5a60cae19025225eda458386e0692bec5eec4 (diff)
networkd: link - only reset transient hostname if it was set by us
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c11
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);