mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 14:00:11 +01:00
dhcp: write DUID out to lease file if not already present
Ensure that dhclient uses the administrator-specified or machine-id generated DUID.
This commit is contained in:
parent
c0efef8c92
commit
1b1b4bd91c
1 changed files with 16 additions and 1 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue