From f5d29e6f61fd9ff145aaf48f6b804e4b15fb48fb Mon Sep 17 00:00:00 2001 From: Jonas Jonsson Date: Wed, 5 Apr 2017 11:13:20 +0200 Subject: [PATCH] dhcp: dhclient: Allow unqualified fqdn.fqdn for DHCPv6 ISC dhclient will always append the zero label to the fqdn.fqdn option. The dhcp-options(5) suggest that it's perfectly fine to have an unqualified name. "... This can be a fully-qualified domain name, or a single label. ..." The ISC dhcpd will ignore this trailing zero label and do DDNS regardless. https://bugzilla.gnome.org/show_bug.cgi?id=761467 --- src/dhcp/nm-dhcp-dhclient-utils.c | 5 +---- src/dhcp/nm-dhcp-dhclient.c | 3 --- src/dhcp/tests/test-dhcp-dhclient.c | 5 ++++- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/dhcp/nm-dhcp-dhclient-utils.c b/src/dhcp/nm-dhcp-dhclient-utils.c index 5bd6c0782..5e1d056ee 100644 --- a/src/dhcp/nm-dhcp-dhclient-utils.c +++ b/src/dhcp/nm-dhcp-dhclient-utils.c @@ -168,10 +168,7 @@ add_ip4_config (GString *str, GBytes *client_id, const char *hostname, const cha static void add_hostname6 (GString *str, const char *hostname) { - /* dhclient only supports the fqdn.fqdn for DHCPv6 and requires a fully- - * qualified name for this option, so we must require one here too. - */ - if (hostname && strchr (hostname, '.')) { + if (hostname) { g_string_append_printf (str, FQDN_FORMAT "\n", hostname); g_string_append (str, "send fqdn.server-update on;\n"); diff --git a/src/dhcp/nm-dhcp-dhclient.c b/src/dhcp/nm-dhcp-dhclient.c index dc66be25d..f8339f9b7 100644 --- a/src/dhcp/nm-dhcp-dhclient.c +++ b/src/dhcp/nm-dhcp-dhclient.c @@ -203,9 +203,6 @@ 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); diff --git a/src/dhcp/tests/test-dhcp-dhclient.c b/src/dhcp/tests/test-dhcp-dhclient.c index 11c07cc11..3ba5f10b2 100644 --- a/src/dhcp/tests/test-dhcp-dhclient.c +++ b/src/dhcp/tests/test-dhcp-dhclient.c @@ -440,6 +440,9 @@ test_override_hostname6 (void) static const char *nonfqdn_hostname6_expected = \ "# Created by NetworkManager\n" "\n" + "send fqdn.fqdn \"blahblah\"; # added by NetworkManager\n" + "send fqdn.server-update on;\n" + "\n" "also request dhcp6.name-servers;\n" "also request dhcp6.domain-search;\n" "also request dhcp6.client-id;\n" @@ -448,7 +451,7 @@ static const char *nonfqdn_hostname6_expected = \ static void test_nonfqdn_hostname6 (void) { - /* Non-FQDN hostname can't be used with dhclient */ + /* Non-FQDN hostname can now be used with dhclient */ test_config (NULL, nonfqdn_hostname6_expected, TRUE, "blahblah", NULL, NULL,