summary refs log tree commit diff
path: root/src/dhcp/nm-dhcp-systemd.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2017-05-11 14:55:55 +0200
committerMichael Biebl <biebl@debian.org>2017-05-11 14:55:55 +0200
commitc333f062ddcba9b35330647bf6cbd0a07f2d786e (patch)
tree257c3a0c74c09f4ad2328eab5b932806405f0c1c /src/dhcp/nm-dhcp-systemd.c
parenta222e56e103f949b148a6942e385ccca2c26d9f3 (diff)
New upstream version 1.8.0 upstream/1.8.0
Diffstat (limited to 'src/dhcp/nm-dhcp-systemd.c')
-rw-r--r--src/dhcp/nm-dhcp-systemd.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c
index 7067275b..aa902701 100644
--- a/src/dhcp/nm-dhcp-systemd.c
+++ b/src/dhcp/nm-dhcp-systemd.c
@@ -580,7 +580,7 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 	const uint8_t *client_id = NULL;
 	size_t client_id_len = 0;
 	struct in_addr last_addr = { 0 };
-	const char *hostname, *fqdn;
+	const char *hostname;
 	int r, i;
 	gboolean success = FALSE;
 	guint16 arp_type;
@@ -687,28 +687,13 @@ ip4_start (NMDhcpClient *client, const char *dhcp_anycast_addr, const char *last
 
 	hostname = nm_dhcp_client_get_hostname (client);
 	if (hostname) {
-		char *prefix, *dot;
-
-		prefix = strdup (hostname);
-		dot = strchr (prefix, '.');
-		/* get rid of the domain */
-		if (dot)
-			*dot = '\0';
-
-		r = sd_dhcp_client_set_hostname (priv->client4, prefix);
-		free (prefix);
-
-		if (r < 0) {
-			_LOGW ("failed to set DHCP hostname (%d)", r);
-			goto error;
-		}
-	}
-
-	fqdn = nm_dhcp_client_get_fqdn (client);
-	if (fqdn) {
-		r = sd_dhcp_client_set_hostname (priv->client4, fqdn);
+		/* FIXME: sd-dhcp decides which hostname/FQDN option to send (12 or 81)
+		 * only based on whether the hostname has a domain part or not. At the
+		 * moment there is no way to force one or another.
+		 */
+		r = sd_dhcp_client_set_hostname (priv->client4, hostname);
 		if (r < 0) {
-			_LOGW ("failed to set DHCP FQDN (%d)", r);
+			_LOGW ("failed to set DHCP hostname to '%s' (%d)", hostname, r);
 			goto error;
 		}
 	}