Commit fcc6bf71 authored by Francesco Giudici's avatar Francesco Giudici

core: add function to retrieve secret_key generation time

This will be soon used to derive the timestamp to generate DHCPv6
DUIDs of type DUID-LLT.
parent 84c9ce0d
......@@ -2896,6 +2896,22 @@ nm_utils_secret_key_get (const guint8 **out_secret_key,
return secret_key->is_good;
}
guint64
nm_utils_secret_key_get_timestamp (void)
{
struct stat stat_buf;
const guint8 *key;
gsize key_len;
if (!nm_utils_secret_key_get (&key, &key_len))
return 0;
if (stat (NMSTATEDIR "/secret_key", &stat_buf) != 0)
return 0;
return stat_buf.st_mtim.tv_sec;
}
/*****************************************************************************/
const char *
......
......@@ -285,6 +285,7 @@ gboolean nm_utils_machine_id_parse (const char *id_str, /*uuid_t*/ guchar *out_u
gboolean nm_utils_secret_key_get (const guint8 **out_secret_key,
gsize *out_key_len);
guint64 nm_utils_secret_key_get_timestamp (void);
const char *nm_utils_get_boot_id (void);
......
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