mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 20:38:10 +02:00
dhcp: use nm_utils_random_bytes() for generating random DUID
This commit is contained in:
parent
b01a453ca2
commit
fb6fecc036
1 changed files with 1 additions and 6 deletions
|
|
@ -481,8 +481,6 @@ generate_duid_from_machine_id (void)
|
||||||
gsize sumlen = sizeof (buffer);
|
gsize sumlen = sizeof (buffer);
|
||||||
const guint16 duid_type = g_htons (4);
|
const guint16 duid_type = g_htons (4);
|
||||||
uuid_t uuid;
|
uuid_t uuid;
|
||||||
GRand *generator;
|
|
||||||
guint i;
|
|
||||||
gs_free char *machine_id_s = NULL;
|
gs_free char *machine_id_s = NULL;
|
||||||
gs_free char *str = NULL;
|
gs_free char *str = NULL;
|
||||||
|
|
||||||
|
|
@ -498,10 +496,7 @@ generate_duid_from_machine_id (void)
|
||||||
"or " LOCALSTATEDIR "/lib/dbus/machine-id to generate "
|
"or " LOCALSTATEDIR "/lib/dbus/machine-id to generate "
|
||||||
"DHCPv6 DUID; creating non-persistent random DUID.");
|
"DHCPv6 DUID; creating non-persistent random DUID.");
|
||||||
|
|
||||||
generator = g_rand_new ();
|
nm_utils_random_bytes (buffer, sizeof (buffer));
|
||||||
for (i = 0; i < sizeof (buffer) / sizeof (guint32); i++)
|
|
||||||
((guint32 *) buffer)[i] = g_rand_int (generator);
|
|
||||||
g_rand_free (generator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate a DHCP Unique Identifier for DHCPv6 using the
|
/* Generate a DHCP Unique Identifier for DHCPv6 using the
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue