From 9c77b06bbcd073f1ba00933565f9b815ff24cc18 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 13 Dec 2017 22:06:18 +0100 Subject: [PATCH] dhcp: systemd: support the hostname property Send the FQDN option when a hostname is set. --- src/dhcp/nm-dhcp-systemd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c index 9b1a44332c..2e552cd4ff 100644 --- a/src/dhcp/nm-dhcp-systemd.c +++ b/src/dhcp/nm-dhcp-systemd.c @@ -915,6 +915,7 @@ ip6_start (NMDhcpClient *client, NMDhcpSystemdPrivate *priv = NM_DHCP_SYSTEMD_GET_PRIVATE (self); const char *iface = nm_dhcp_client_get_iface (client); const GByteArray *hwaddr; + const char *hostname; int r, i; g_assert (priv->client4 == NULL); @@ -995,6 +996,13 @@ ip6_start (NMDhcpClient *client, goto error; } + hostname = nm_dhcp_client_get_hostname (client); + r = sd_dhcp6_client_set_fqdn (priv->client6, hostname); + if (r < 0) { + _LOGW ("failed to set DHCP hostname to '%s' (%d)", hostname, r); + goto error; + } + r = sd_dhcp6_client_start (priv->client6); if (r < 0) { _LOGW ("failed to start client (%d)", r);