summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-05-31 10:00:57 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-05-31 10:49:46 +0200
commita2f5ba8e06eed1090c0960652641c74a83f15896 (patch)
treefa992a4abb60afe62f72e815048f13eba5b45baf
parentf97ffea82e798b215bfd5fd74119a67ccdcb532f (diff)
downloadNetworkManager-a2f5ba8e06eed1090c0960652641c74a83f15896.tar.gz
dhcp/dhclient: emit a warning if the DHCPv6 hostname is not a FQDN
RFC 4704 ("The DHCPv6 Client FQDN Option") allows both partial and fully-qualified names in the FQDN option, however dhclient always appends a terminating zero-length label to the name, so we ignore unqualified hostnames to prevent a wrong configuration. Emit a warning when the field is ignored so that users can clearly see why the hostname is not being sent.
-rw-r--r--src/dhcp-manager/nm-dhcp-dhclient.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c
index 17517c2f16..ade206bad9 100644
--- a/src/dhcp-manager/nm-dhcp-dhclient.c
+++ b/src/dhcp-manager/nm-dhcp-dhclient.c
@@ -178,6 +178,9 @@ merge_dhclient_config (NMDhcpDhclient *self,
}
}
+ if (is_ip6 && hostname && !strchr (hostname, '.'))
+ _LOGW ("hostname is not a FQDN, it will be ignored");
+
new = nm_dhcp_dhclient_create_config (iface, is_ip6, client_id, anycast_addr, hostname, fqdn, orig_path, orig, out_new_client_id);
g_assert (new);
success = g_file_set_contents (conf_file, new, -1, error);