summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-03-22 14:49:18 +0100
committerThomas Haller <thaller@redhat.com>2016-03-22 15:03:11 +0100
commitd3e3ff73ab8af553de8f730ba0246ef337cf5040 (patch)
tree688ec5365244340ce6e30b9029d3236dbc98141f
parent3f06384d267b05a30840d5a3b4f570465cbeb5b6 (diff)
downloadNetworkManager-fg/DUID-IPv4-bgo745243.tar.gz
fixup! dhcp: use DHCPv6 DUID to construct DHCPv4 Client ID (dhclient)fg/DUID-IPv4-bgo745243
-rw-r--r--src/dhcp-manager/nm-dhcp-client.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index 70e22ce157..f65ba07f98 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -501,15 +501,11 @@ get_duid (NMDhcpClient *self)
duid = generate_duid_from_machine_id ();
g_assert (duid);
- _LOGD ("generated DUID %s",
- (str = nm_dhcp_utils_duid_to_string (duid)));
- }
-
- if (G_LIKELY (duid)) {
- copy = g_byte_array_sized_new (duid->len);
- g_byte_array_append (copy, duid->data, duid->len);
+ _LOGD ("generated DUID %s", (str = nm_dhcp_utils_duid_to_string (duid)));
}
+ copy = g_byte_array_sized_new (duid->len);
+ g_byte_array_append (copy, duid->data, duid->len);
return copy;
}
@@ -546,10 +542,7 @@ nm_dhcp_client_start_ip4 (NMDhcpClient *self,
if (!priv->duid)
priv->duid = NM_DHCP_CLIENT_GET_CLASS (self)->get_duid (self);
- if (nm_logging_enabled (LOGL_DEBUG, LOGD_DHCP4)) {
- str = nm_dhcp_utils_duid_to_string (priv->duid);
- _LOGD ("DUID is '%s'", str);
- }
+ _LOGD ("DUID is '%s'", (str = nm_dhcp_utils_duid_to_string (priv->duid)));
}
nm_dhcp_client_set_client_id (self, tmp);
@@ -573,7 +566,7 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self,
NMSettingIP6ConfigPrivacy privacy)
{
NMDhcpClientPrivate *priv;
- char *str;
+ gs_free char *str = NULL;
g_return_val_if_fail (NM_IS_DHCP_CLIENT (self), FALSE);
@@ -588,11 +581,7 @@ nm_dhcp_client_start_ip6 (NMDhcpClient *self,
if (!priv->duid)
priv->duid = NM_DHCP_CLIENT_GET_CLASS (self)->get_duid (self);
- if (nm_logging_enabled (LOGL_DEBUG, LOGD_DHCP6)) {
- str = nm_dhcp_utils_duid_to_string (priv->duid);
- _LOGD ("DUID is '%s'", str);
- g_free (str);
- }
+ _LOGD ("DUID is '%s'", (str = nm_dhcp_utils_duid_to_string (priv->duid)));
g_clear_pointer (&priv->hostname, g_free);
priv->hostname = g_strdup (hostname);