summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-12-13 22:06:18 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-12-13 22:06:18 +0100
commit9c77b06bbcd073f1ba00933565f9b815ff24cc18 (patch)
treef5eddbfeda05621df1cd5149c7cb8d8b4a13605e
parent03637ad8b5d21fcc12a536a25caf46445aabde73 (diff)
dhcp: systemd: support the hostname property
Send the FQDN option when a hostname is set.
-rw-r--r--src/dhcp/nm-dhcp-systemd.c8
1 files changed, 8 insertions, 0 deletions
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);