summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Jonsson <jonas@ludd.ltu.se>2017-04-05 11:13:20 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2017-05-03 09:46:45 +0200
commitf5d29e6f61fd9ff145aaf48f6b804e4b15fb48fb (patch)
tree6183a1977f0534dda9421dca024888a753860fe1
parentbd805b7e49849c76e4bd273799ae84c718033dc0 (diff)
downloadNetworkManager-f5d29e6f61fd9ff145aaf48f6b804e4b15fb48fb.tar.gz
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
-rw-r--r--src/dhcp/nm-dhcp-dhclient-utils.c5
-rw-r--r--src/dhcp/nm-dhcp-dhclient.c3
-rw-r--r--src/dhcp/tests/test-dhcp-dhclient.c5
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 5bd6c0782e..5e1d056ee0 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 dc66be25dd..f8339f9b7b 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 11c07cc11e..3ba5f10b20 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,