Commit 1b1b4bd9 authored by Dan Williams's avatar Dan Williams

dhcp: write DUID out to lease file if not already present

Ensure that dhclient uses the administrator-specified or machine-id
generated DUID.
parent c0efef8c
......@@ -455,8 +455,9 @@ dhclient_start (NMDHCPClient *client,
GError *error = NULL;
const char *iface, *uuid, *system_bus_address;
char *binary_name, *cmd_str, *pid_file = NULL, *system_bus_address_env = NULL;
gboolean ipv6;
gboolean ipv6, success;
guint log_domain;
char *escaped;
g_return_val_if_fail (priv->pid_file == NULL, -1);
......@@ -489,6 +490,20 @@ dhclient_start (NMDHCPClient *client,
g_free (priv->lease_file);
priv->lease_file = get_dhclient_leasefile (iface, uuid, ipv6);
/* Save the DUID to the leasefile dhclient will actually use */
if (ipv6) {
escaped = nm_dhcp_dhclient_escape_duid (duid);
success = nm_dhcp_dhclient_save_duid (priv->lease_file, escaped, &error);
g_free (escaped);
if (!success) {
nm_log_warn (log_domain, "(%s): failed to save DUID to %s: (%d) %s.",
iface, priv->lease_file,
error ? error->code : -1,
error && error->message ? error->message : "(unknown)");
return -1;
argv = g_ptr_array_new ();
g_ptr_array_add (argv, (gpointer) priv->path);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment