Re: DHCPv6 DDNS registration with FQDN
- From: Dan Williams <dcbw redhat com>
- To: Alexander Groß <agross therightstuff de>
- Cc: networkmanager-list gnome org
- Subject: Re: DHCPv6 DDNS registration with FQDN
- Date: Tue, 24 Feb 2015 17:09:26 -0600
On Fri, 2015-02-06 at 10:39 +0100, Alexander Groß wrote:
On Thu, Feb 5, 2015 at 1:02 AM, Dan Williams <dcbw redhat com> wrote:
The question is why it was done that way
originally, which I haven't looked into yet but will do.
The commit that added the code is 90b995. It hasn't been change since.
Can you rebuild with the attached patch and see if that makes things
work for you? If so I'll go ahead and commit it, and backport to 0.9.10
and 1.0.
Thanks!
Dan
----
dhclient only supports fqdn.fqdn for server DDNS updates with
DHCPv6. And even though the underlying DHCP options that fqdn.fqdn
controls allow non-qualified hostnames on the wire, dhclient does
not. So we must require a fully-qualified name for DHCPv6.
Second, while no-client-updates seems like it should be "off", doing
that apparently makes dhclient set the "O" flag to 1 which appears to
be a bug, and results in the server not doing the DDNS update. So
we must stop setting that option too.
Found by: Alexander Groß
---
src/dhcp-manager/nm-dhcp-dhclient-utils.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.c b/src/dhcp-manager/nm-dhcp-dhclient-utils.c
index 46e8e0b..54381a0 100644
--- a/src/dhcp-manager/nm-dhcp-dhclient-utils.c
+++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.c
@@ -39,8 +39,8 @@
#define HOSTNAME4_TAG "send host-name"
#define HOSTNAME4_FORMAT HOSTNAME4_TAG " \"%s\"; # added by NetworkManager"
-#define HOSTNAME6_TAG "send fqdn.fqdn"
-#define HOSTNAME6_FORMAT HOSTNAME6_TAG " \"%s\"; # added by NetworkManager"
+#define FQDN_TAG "send fqdn.fqdn"
+#define FQDN_FORMAT FQDN_TAG " \"%s\"; # added by NetworkManager"
#define ALSOREQ_TAG "also request "
@@ -57,7 +57,7 @@ add_also_request (GPtrArray *array, const char *item)
}
static void
-add_hostname (GString *str, const char *format, const char *hostname)
+add_hostname4 (GString *str, const char *format, const char *hostname)
{
char *plain_hostname, *dot;
@@ -109,7 +109,7 @@ add_ip4_config (GString *str, GBytes *client_id, const char *hostname)
g_string_append (str, "; # added by NetworkManager\n");
}
- add_hostname (str, HOSTNAME4_FORMAT "\n", hostname);
+ add_hostname4 (str, HOSTNAME4_FORMAT "\n", hostname);
g_string_append_c (str, '\n');
@@ -125,13 +125,17 @@ add_ip4_config (GString *str, GBytes *client_id, const char *hostname)
}
static void
-add_ip6_config (GString *str, const char *hostname)
+add_hostname6 (GString *str, const char *hostname)
{
- add_hostname (str, HOSTNAME6_FORMAT "\n", hostname);
- g_string_append (str,
- "send fqdn.encoded on;\n"
- "send fqdn.no-client-update on;\n"
- "send fqdn.server-update on;\n");
+ /* 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, '.')) {
+ g_string_append_printf (str, FQDN_FORMAT "\n", hostname);
+ g_string_append (str,
+ "send fqdn.encoded on;\n"
+ "send fqdn.server-update on;\n");
+ }
}
static GBytes *
@@ -232,7 +236,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
if (hostname) {
if (strncmp (p, HOSTNAME4_TAG, strlen (HOSTNAME4_TAG)) == 0)
continue;
- if (strncmp (p, HOSTNAME6_TAG, strlen (HOSTNAME6_TAG)) == 0)
+ if (strncmp (p, FQDN_TAG, strlen (FQDN_TAG)) == 0)
continue;
}
@@ -290,7 +294,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
g_string_append_c (new_contents, '\n');
if (is_ip6) {
- add_ip6_config (new_contents, hostname);
+ add_hostname6 (new_contents, hostname);
add_also_request (alsoreq, "dhcp6.name-servers");
add_also_request (alsoreq, "dhcp6.domain-search");
add_also_request (alsoreq, "dhcp6.client-id");
--
2.1.0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]