mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 01:00:09 +01:00
glib-aux/trivial: rename NMUuid API
This commit is contained in:
parent
78297db721
commit
995c78245e
11 changed files with 94 additions and 135 deletions
|
|
@ -1718,11 +1718,11 @@ new_default_connection(NMDevice *self)
|
|||
|
||||
/* Create a stable UUID. The UUID is also the Network_ID for stable-privacy addr-gen-mode,
|
||||
* thus when it changes we will also generate different IPv6 addresses. */
|
||||
uuid = _nm_utils_uuid_generate_from_strings("default-wired",
|
||||
nm_utils_machine_id_str(),
|
||||
defname,
|
||||
perm_hw_addr ?: iface,
|
||||
NULL);
|
||||
uuid = nm_uuid_generate_from_strings("default-wired",
|
||||
nm_utils_machine_id_str(),
|
||||
defname,
|
||||
perm_hw_addr ?: iface,
|
||||
NULL);
|
||||
|
||||
g_object_set(setting,
|
||||
NM_SETTING_CONNECTION_ID,
|
||||
|
|
|
|||
|
|
@ -2500,11 +2500,11 @@ again:
|
|||
|
||||
/* the fake machine-id is based on secret-key/boot-id, but we hash it
|
||||
* again, so that they are not literally the same. */
|
||||
nm_utils_uuid_generate_from_string_bin(&uuid,
|
||||
(const char *) seed_bin,
|
||||
seed_len,
|
||||
NM_UTILS_UUID_TYPE_VERSION5,
|
||||
(gpointer) hash_seed);
|
||||
nm_uuid_generate_from_string(&uuid,
|
||||
(const char *) seed_bin,
|
||||
seed_len,
|
||||
NM_UUID_TYPE_VERSION5,
|
||||
(gpointer) hash_seed);
|
||||
}
|
||||
|
||||
if (!g_once_init_enter(&lock))
|
||||
|
|
|
|||
|
|
@ -405,11 +405,9 @@ make_connection_setting(const char *file,
|
|||
/* Try for a UUID key before falling back to hashing the file name */
|
||||
uuid = svGetValueStr(ifcfg, "UUID", &uuid_free);
|
||||
if (!uuid) {
|
||||
uuid_free = nm_utils_uuid_generate_from_string(svFileGetName(ifcfg),
|
||||
-1,
|
||||
NM_UTILS_UUID_TYPE_LEGACY,
|
||||
NULL);
|
||||
uuid = uuid_free;
|
||||
uuid_free =
|
||||
nm_uuid_generate_from_string_str(svFileGetName(ifcfg), -1, NM_UUID_TYPE_LEGACY, NULL);
|
||||
uuid = uuid_free;
|
||||
}
|
||||
|
||||
g_object_set(s_con,
|
||||
|
|
|
|||
|
|
@ -635,7 +635,7 @@ ifupdown_new_connection_from_if_block(if_block *block, gboolean autoconnect, GEr
|
|||
type = _ifupdownplugin_guess_connection_type(block);
|
||||
idstr = g_strconcat("Ifupdown (", block->name, ")", NULL);
|
||||
|
||||
uuid = nm_utils_uuid_generate_from_string(idstr, -1, NM_UTILS_UUID_TYPE_LEGACY, NULL);
|
||||
uuid = nm_uuid_generate_from_string_str(idstr, -1, NM_UUID_TYPE_LEGACY, NULL);
|
||||
g_object_set(s_con,
|
||||
NM_SETTING_CONNECTION_TYPE,
|
||||
type,
|
||||
|
|
|
|||
|
|
@ -2289,7 +2289,7 @@ test_read_missing_id_uuid(void)
|
|||
gs_free char * expected_uuid = NULL;
|
||||
const char * FILENAME = TEST_KEYFILES_DIR "/Test_Missing_ID_UUID";
|
||||
|
||||
expected_uuid = _nm_utils_uuid_generate_from_strings("keyfile", FILENAME, NULL);
|
||||
expected_uuid = nm_uuid_generate_from_strings("keyfile", FILENAME, NULL);
|
||||
|
||||
connection = keyfile_read_connection_from_file(FILENAME);
|
||||
|
||||
|
|
|
|||
|
|
@ -3695,7 +3695,7 @@ nm_keyfile_read_ensure_uuid(NMConnection *connection, const char *fallback_uuid_
|
|||
if (nm_setting_connection_get_uuid(s_con))
|
||||
return FALSE;
|
||||
|
||||
hashed_uuid = _nm_utils_uuid_generate_from_strings("keyfile", fallback_uuid_seed, NULL);
|
||||
hashed_uuid = nm_uuid_generate_from_strings("keyfile", fallback_uuid_seed, NULL);
|
||||
g_object_set(s_con, NM_SETTING_CONNECTION_UUID, hashed_uuid, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1854,7 +1854,7 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
|
|||
* The UUID must be in the format "2815492f-7e56-435e-b2e9-246bd7cdc664"
|
||||
* (ie, contains only hexadecimal characters and "-"). A suitable UUID may
|
||||
* be generated by nm_utils_uuid_generate() or
|
||||
* nm_utils_uuid_generate_from_string().
|
||||
* nm_uuid_generate_from_string_str().
|
||||
**/
|
||||
/* ---ifcfg-rh---
|
||||
* property: uuid
|
||||
|
|
|
|||
|
|
@ -7232,7 +7232,7 @@ _test_uuid(int uuid_type,
|
|||
{
|
||||
gs_free char *uuid_test = NULL;
|
||||
|
||||
uuid_test = nm_utils_uuid_generate_from_string(str, slen, uuid_type, type_args);
|
||||
uuid_test = nm_uuid_generate_from_string_str(str, slen, uuid_type, type_args);
|
||||
|
||||
g_assert(uuid_test);
|
||||
g_assert(nm_utils_is_uuid(uuid_test));
|
||||
|
|
@ -7242,7 +7242,7 @@ _test_uuid(int uuid_type,
|
|||
uuid_type,
|
||||
str,
|
||||
(long long) slen,
|
||||
NM_IN_SET(uuid_type, NM_UTILS_UUID_TYPE_VERSION3, NM_UTILS_UUID_TYPE_VERSION5)
|
||||
NM_IN_SET(uuid_type, NM_UUID_TYPE_VERSION3, NM_UUID_TYPE_VERSION5)
|
||||
? (((const char *) type_args) ?: "(all-zero)")
|
||||
: (type_args ? "(unknown)" : "(null)"),
|
||||
uuid_test,
|
||||
|
|
@ -7257,8 +7257,7 @@ _test_uuid(int uuid_type,
|
|||
_test_uuid(uuid_type, expected_uuid, NULL, 0, type_args);
|
||||
}
|
||||
|
||||
if (NM_IN_SET(uuid_type, NM_UTILS_UUID_TYPE_VERSION3, NM_UTILS_UUID_TYPE_VERSION5)
|
||||
&& !type_args) {
|
||||
if (NM_IN_SET(uuid_type, NM_UUID_TYPE_VERSION3, NM_UUID_TYPE_VERSION5) && !type_args) {
|
||||
/* For version3 and version5, a missing @type_args is equal to UUID_NS_ZERO */
|
||||
_test_uuid(uuid_type, expected_uuid, str, slen, UUID_NS_ZERO);
|
||||
}
|
||||
|
|
@ -7679,76 +7678,44 @@ test_nm_utils_uuid_generate_from_string(void)
|
|||
char i_str[30];
|
||||
guint i;
|
||||
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_LEGACY, "d41d8cd9-8f00-b204-e980-0998ecf8427e", "", -1, NULL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_LEGACY, "0cc175b9-c0f1-b6a8-31c3-99e269772661", "a", -1, NULL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_LEGACY, "098f6bcd-4621-d373-cade-4e832627b4f6", "test", -1, NULL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_LEGACY, "70350f60-27bc-e371-3f6b-76473084309b", "a\0b", 3, NULL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_LEGACY,
|
||||
_test_uuid(NM_UUID_TYPE_LEGACY, "d41d8cd9-8f00-b204-e980-0998ecf8427e", "", -1, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_LEGACY, "0cc175b9-c0f1-b6a8-31c3-99e269772661", "a", -1, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_LEGACY, "098f6bcd-4621-d373-cade-4e832627b4f6", "test", -1, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_LEGACY, "70350f60-27bc-e371-3f6b-76473084309b", "a\0b", 3, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_LEGACY,
|
||||
"59c0547b-7fe2-1c15-2cce-e328e8bf6742",
|
||||
"/etc/NetworkManager/system-connections/em1",
|
||||
-1,
|
||||
NULL);
|
||||
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3, "4ae71336-e44b-39bf-b9d2-752e234818a5", "", -1, NULL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3, "0531103a-d8fc-3dd4-b972-d98e4750994e", "a", -1, NULL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
"96e17d7a-ac89-38cf-95e1-bf5098da34e1",
|
||||
"test",
|
||||
-1,
|
||||
NULL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
"8156568e-4ae6-3f34-a93e-18e2c6cbbf78",
|
||||
"a\0b",
|
||||
3,
|
||||
NULL);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3, "4ae71336-e44b-39bf-b9d2-752e234818a5", "", -1, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3, "0531103a-d8fc-3dd4-b972-d98e4750994e", "a", -1, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3, "96e17d7a-ac89-38cf-95e1-bf5098da34e1", "test", -1, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3, "8156568e-4ae6-3f34-a93e-18e2c6cbbf78", "a\0b", 3, NULL);
|
||||
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
"c87ee674-4ddc-3efe-a74e-dfe25da5d7b3",
|
||||
"",
|
||||
-1,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
"4c104dd0-4821-30d5-9ce3-0e7a1f8b7c0d",
|
||||
"a",
|
||||
-1,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3, "c87ee674-4ddc-3efe-a74e-dfe25da5d7b3", "", -1, UUID_NS_DNS);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3, "4c104dd0-4821-30d5-9ce3-0e7a1f8b7c0d", "a", -1, UUID_NS_DNS);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3,
|
||||
"45a113ac-c7f2-30b0-90a5-a399ab912716",
|
||||
"test",
|
||||
-1,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3,
|
||||
"002a0ada-f547-375a-bab5-896a11d1927e",
|
||||
"a\0b",
|
||||
3,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3,
|
||||
"9a75f5f2-195e-31a9-9d07-8c18b5d3b285",
|
||||
"test123",
|
||||
-1,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
"ec794efe-a384-3b11-a0b6-ec8995bc6acc",
|
||||
"x",
|
||||
-1,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3, "ec794efe-a384-3b11-a0b6-ec8995bc6acc", "x", -1, UUID_NS_DNS);
|
||||
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5,
|
||||
"a7650b9f-f19f-5300-8a13-91160ea8de2c",
|
||||
"a\0b",
|
||||
3,
|
||||
NULL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5,
|
||||
"4f3f2898-69e3-5a0d-820a-c4e87987dbce",
|
||||
"a",
|
||||
-1,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5,
|
||||
"05b16a01-46c6-56dd-bd6e-c6dfb4a1427a",
|
||||
"x",
|
||||
-1,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5, "a7650b9f-f19f-5300-8a13-91160ea8de2c", "a\0b", 3, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5, "4f3f2898-69e3-5a0d-820a-c4e87987dbce", "a", -1, UUID_NS_DNS);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5, "05b16a01-46c6-56dd-bd6e-c6dfb4a1427a", "x", -1, UUID_NS_DNS);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5,
|
||||
"c9ed566a-6b79-5d3a-b2b7-96a936b48cf3",
|
||||
"test123",
|
||||
-1,
|
||||
|
|
@ -7756,58 +7723,58 @@ test_nm_utils_uuid_generate_from_string(void)
|
|||
|
||||
for (i = 0; i < G_N_ELEMENTS(zero_uuids); i++) {
|
||||
nm_sprintf_buf(i_str, "%u", i),
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3, zero_uuids[i].uuid3, i_str, -1, NULL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5, zero_uuids[i].uuid5, i_str, -1, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3, zero_uuids[i].uuid3, i_str, -1, NULL);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5, zero_uuids[i].uuid5, i_str, -1, NULL);
|
||||
}
|
||||
for (i = 0; i < G_N_ELEMENTS(dns_uuids); i++) {
|
||||
nm_sprintf_buf(i_str, "%u", i),
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3, dns_uuids[i].uuid3, i_str, -1, UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5, dns_uuids[i].uuid5, i_str, -1, UUID_NS_DNS);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3, dns_uuids[i].uuid3, i_str, -1, UUID_NS_DNS);
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5, dns_uuids[i].uuid5, i_str, -1, UUID_NS_DNS);
|
||||
}
|
||||
|
||||
/* examples from cpython unit tests: */
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3,
|
||||
"6fa459ea-ee8a-3ca4-894e-db77e160355e",
|
||||
"python.org",
|
||||
-1,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5,
|
||||
"886313e1-3b8a-5372-9b90-0c9aee199e5d",
|
||||
"python.org",
|
||||
-1,
|
||||
UUID_NS_DNS);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3,
|
||||
"9fe8e8c4-aaa8-32a9-a55c-4535a88b748d",
|
||||
"http://python.org/",
|
||||
-1,
|
||||
UUID_NS_URL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5,
|
||||
"4c565f0d-3f5a-5890-b41b-20cf47701c5e",
|
||||
"http://python.org/",
|
||||
-1,
|
||||
UUID_NS_URL);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3,
|
||||
"dd1a1cef-13d5-368a-ad82-eca71acd4cd1",
|
||||
"1.3.6.1",
|
||||
-1,
|
||||
UUID_NS_OID);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5,
|
||||
"1447fa61-5277-5fef-a9b3-fbc6e44f4af3",
|
||||
"1.3.6.1",
|
||||
-1,
|
||||
UUID_NS_OID);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION3,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION3,
|
||||
"658d3002-db6b-3040-a1d1-8ddd7d189a4d",
|
||||
"c=ca",
|
||||
-1,
|
||||
UUID_NS_X500);
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5,
|
||||
"cc957dd1-a972-5349-98cd-874190002798",
|
||||
"c=ca",
|
||||
-1,
|
||||
UUID_NS_X500);
|
||||
|
||||
_test_uuid(NM_UTILS_UUID_TYPE_VERSION5,
|
||||
_test_uuid(NM_UUID_TYPE_VERSION5,
|
||||
"74738ff5-5367-5958-9aee-98fffdcd1876",
|
||||
"www.example.org",
|
||||
-1,
|
||||
|
|
@ -7831,10 +7798,7 @@ __test_uuid(const char *expected_uuid, const char *str, gssize slen, char *uuid_
|
|||
}
|
||||
g_free(uuid_test);
|
||||
|
||||
uuid_test = nm_utils_uuid_generate_from_string(str,
|
||||
slen,
|
||||
NM_UTILS_UUID_TYPE_VERSION3,
|
||||
NM_UTILS_UUID_NS);
|
||||
uuid_test = nm_uuid_generate_from_string_str(str, slen, NM_UUID_TYPE_VERSION3, NM_UUID_NS1);
|
||||
|
||||
g_assert(uuid_test);
|
||||
g_assert(nm_utils_is_uuid(uuid_test));
|
||||
|
|
@ -7850,7 +7814,7 @@ __test_uuid(const char *expected_uuid, const char *str, gssize slen, char *uuid_
|
|||
}
|
||||
|
||||
#define _test_uuid(expected_uuid, str, strlen, ...) \
|
||||
__test_uuid(expected_uuid, str, strlen, _nm_utils_uuid_generate_from_strings(__VA_ARGS__, NULL))
|
||||
__test_uuid(expected_uuid, str, strlen, nm_uuid_generate_from_strings(__VA_ARGS__, NULL))
|
||||
|
||||
static void
|
||||
test_nm_utils_uuid_generate_from_strings(void)
|
||||
|
|
@ -10828,7 +10792,7 @@ main(int argc, char **argv)
|
|||
g_test_add_func("/core/general/nm_strquote", test_nm_strquote);
|
||||
g_test_add_func("/core/general/test_nm_utils_uuid_generate_from_string",
|
||||
test_nm_utils_uuid_generate_from_string);
|
||||
g_test_add_func("/core/general/_nm_utils_uuid_generate_from_strings",
|
||||
g_test_add_func("/core/general/nm_uuid_generate_from_strings",
|
||||
test_nm_utils_uuid_generate_from_strings);
|
||||
|
||||
g_test_add_func("/core/general/_nm_utils_ascii_str_to_int64", test_nm_utils_ascii_str_to_int64);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ nm_uuid_generate_random_str(char buf[static 37])
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_utils_uuid_generate_from_string_bin:
|
||||
* nm_uuid_generate_from_string:
|
||||
* @uuid: the UUID to update inplace. This function cannot
|
||||
* fail to succeed.
|
||||
* @s: a string to use as the seed for the UUID
|
||||
|
|
@ -173,11 +173,11 @@ nm_uuid_generate_random_str(char buf[static 37])
|
|||
* Returns: the input @uuid. This function cannot fail.
|
||||
**/
|
||||
NMUuid *
|
||||
nm_utils_uuid_generate_from_string_bin(NMUuid * uuid,
|
||||
const char *s,
|
||||
gssize slen,
|
||||
int uuid_type,
|
||||
gpointer type_args)
|
||||
nm_uuid_generate_from_string(NMUuid * uuid,
|
||||
const char *s,
|
||||
gssize slen,
|
||||
int uuid_type,
|
||||
gpointer type_args)
|
||||
{
|
||||
g_return_val_if_fail(uuid, FALSE);
|
||||
g_return_val_if_fail(slen == 0 || s, FALSE);
|
||||
|
|
@ -186,12 +186,12 @@ nm_utils_uuid_generate_from_string_bin(NMUuid * uuid,
|
|||
slen = s ? strlen(s) : 0;
|
||||
|
||||
switch (uuid_type) {
|
||||
case NM_UTILS_UUID_TYPE_LEGACY:
|
||||
case NM_UUID_TYPE_LEGACY:
|
||||
g_return_val_if_fail(!type_args, NULL);
|
||||
nm_crypto_md5_hash(NULL, 0, (guint8 *) s, slen, (guint8 *) uuid, sizeof(*uuid));
|
||||
break;
|
||||
case NM_UTILS_UUID_TYPE_VERSION3:
|
||||
case NM_UTILS_UUID_TYPE_VERSION5:
|
||||
case NM_UUID_TYPE_VERSION3:
|
||||
case NM_UUID_TYPE_VERSION5:
|
||||
{
|
||||
NMUuid ns_uuid = {};
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ nm_utils_uuid_generate_from_string_bin(NMUuid * uuid,
|
|||
g_return_val_if_reached(NULL);
|
||||
}
|
||||
|
||||
if (uuid_type == NM_UTILS_UUID_TYPE_VERSION3) {
|
||||
if (uuid_type == NM_UUID_TYPE_VERSION3) {
|
||||
nm_crypto_md5_hash((guint8 *) s,
|
||||
slen,
|
||||
(guint8 *) &ns_uuid,
|
||||
|
|
@ -236,7 +236,7 @@ nm_utils_uuid_generate_from_string_bin(NMUuid * uuid,
|
|||
}
|
||||
|
||||
/**
|
||||
* nm_utils_uuid_generate_from_string:
|
||||
* nm_uuid_generate_from_string_str:
|
||||
* @s: a string to use as the seed for the UUID
|
||||
* @slen: if negative, treat @s as zero terminated C string.
|
||||
* Otherwise, assume the length as given (and allow @s to be
|
||||
|
|
@ -250,16 +250,16 @@ nm_utils_uuid_generate_from_string_bin(NMUuid * uuid,
|
|||
* object's #NMSettingConnection:id: property
|
||||
**/
|
||||
char *
|
||||
nm_utils_uuid_generate_from_string(const char *s, gssize slen, int uuid_type, gpointer type_args)
|
||||
nm_uuid_generate_from_string_str(const char *s, gssize slen, int uuid_type, gpointer type_args)
|
||||
{
|
||||
NMUuid uuid;
|
||||
|
||||
nm_utils_uuid_generate_from_string_bin(&uuid, s, slen, uuid_type, type_args);
|
||||
nm_uuid_generate_from_string(&uuid, s, slen, uuid_type, type_args);
|
||||
return nm_uuid_unparse(&uuid, g_new(char, 37));
|
||||
}
|
||||
|
||||
/**
|
||||
* _nm_utils_uuid_generate_from_strings:
|
||||
* nm_uuid_generate_from_strings:
|
||||
* @string1: a variadic list of strings. Must be NULL terminated.
|
||||
*
|
||||
* Returns a variant3 UUID based on the concatenated C strings.
|
||||
|
|
@ -272,13 +272,10 @@ nm_utils_uuid_generate_from_string(const char *s, gssize slen, int uuid_type, gp
|
|||
* ("aa"), ("aa", ""), ("", "aa"), ...
|
||||
*/
|
||||
char *
|
||||
_nm_utils_uuid_generate_from_strings(const char *string1, ...)
|
||||
nm_uuid_generate_from_strings(const char *string1, ...)
|
||||
{
|
||||
if (!string1)
|
||||
return nm_utils_uuid_generate_from_string(NULL,
|
||||
0,
|
||||
NM_UTILS_UUID_TYPE_VERSION3,
|
||||
NM_UTILS_UUID_NS);
|
||||
return nm_uuid_generate_from_string_str(NULL, 0, NM_UUID_TYPE_VERSION3, NM_UUID_NS1);
|
||||
|
||||
{
|
||||
nm_auto_str_buf NMStrBuf str = NM_STR_BUF_INIT(NM_UTILS_GET_NEXT_REALLOC_SIZE_104, FALSE);
|
||||
|
|
@ -295,9 +292,9 @@ _nm_utils_uuid_generate_from_strings(const char *string1, ...)
|
|||
}
|
||||
va_end(args);
|
||||
|
||||
return nm_utils_uuid_generate_from_string(nm_str_buf_get_str_unsafe(&str),
|
||||
str.len,
|
||||
NM_UTILS_UUID_TYPE_VERSION3,
|
||||
NM_UTILS_UUID_NS);
|
||||
return nm_uuid_generate_from_string_str(nm_str_buf_get_str_unsafe(&str),
|
||||
str.len,
|
||||
NM_UUID_TYPE_VERSION3,
|
||||
NM_UUID_NS1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,23 +47,23 @@ char *nm_uuid_generate_random_str(char buf[static 37]);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_UTILS_UUID_TYPE_LEGACY 0
|
||||
#define NM_UTILS_UUID_TYPE_VERSION3 3
|
||||
#define NM_UTILS_UUID_TYPE_VERSION5 5
|
||||
#define NM_UUID_TYPE_LEGACY 0
|
||||
#define NM_UUID_TYPE_VERSION3 3
|
||||
#define NM_UUID_TYPE_VERSION5 5
|
||||
|
||||
NMUuid *nm_utils_uuid_generate_from_string_bin(NMUuid * uuid,
|
||||
const char *s,
|
||||
gssize slen,
|
||||
int uuid_type,
|
||||
gpointer type_args);
|
||||
NMUuid *nm_uuid_generate_from_string(NMUuid * uuid,
|
||||
const char *s,
|
||||
gssize slen,
|
||||
int uuid_type,
|
||||
gpointer type_args);
|
||||
|
||||
char *
|
||||
nm_utils_uuid_generate_from_string(const char *s, gssize slen, int uuid_type, gpointer type_args);
|
||||
nm_uuid_generate_from_string_str(const char *s, gssize slen, int uuid_type, gpointer type_args);
|
||||
|
||||
/* arbitrarily chosen namespace UUID for _nm_utils_uuid_generate_from_strings() */
|
||||
#define NM_UTILS_UUID_NS "b425e9fb-7598-44b4-9e3b-5a2e3aaa4905"
|
||||
/* arbitrarily chosen namespace UUID for nm_uuid_generate_from_strings() */
|
||||
#define NM_UUID_NS1 "b425e9fb-7598-44b4-9e3b-5a2e3aaa4905"
|
||||
|
||||
char *_nm_utils_uuid_generate_from_strings(const char *string1, ...) G_GNUC_NULL_TERMINATED;
|
||||
char *nm_uuid_generate_from_strings(const char *string1, ...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -304,13 +304,13 @@ connection_setting_add(GHashTable * nic,
|
|||
s_index ? " " : "",
|
||||
s_index ? s_index : "");
|
||||
|
||||
uuid = _nm_utils_uuid_generate_from_strings("ibft",
|
||||
s_hwaddr,
|
||||
s_vlanid ? "V" : "v",
|
||||
s_vlanid ? s_vlanid : "",
|
||||
s_ipaddr ? "A" : "DHCP",
|
||||
s_ipaddr ? s_ipaddr : "",
|
||||
NULL);
|
||||
uuid = nm_uuid_generate_from_strings("ibft",
|
||||
s_hwaddr,
|
||||
s_vlanid ? "V" : "v",
|
||||
s_vlanid ? s_vlanid : "",
|
||||
s_ipaddr ? "A" : "DHCP",
|
||||
s_ipaddr ? s_ipaddr : "",
|
||||
NULL);
|
||||
|
||||
s_con = (NMSetting *) nm_connection_get_setting_connection(connection);
|
||||
if (!s_con) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue