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
This commit is contained in:

committed by
Beniamino Galvani

parent
bd805b7e49
commit
f5d29e6f61
@@ -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");
|
||||
|
@@ -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);
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user