mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 07:38:20 +02:00
merge branch 'th/misc'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1278
This commit is contained in:
commit
4d68d47924
3 changed files with 26 additions and 28 deletions
|
|
@ -417,9 +417,10 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
nm_log_info(LOGD_CORE,
|
||||
"NetworkManager (version " NM_DIST_VERSION ") is starting... (%s%s)",
|
||||
nm_config_get_first_start(config) ? "for the first time" : "after a restart",
|
||||
NM_MORE_ASSERTS != 0 ? ", asserts:" G_STRINGIFY(NM_MORE_ASSERTS) : "");
|
||||
"NetworkManager (version " NM_DIST_VERSION ") is starting... (%s%sboot:%s)",
|
||||
nm_config_get_first_start(config) ? "" : "after a restart, ",
|
||||
NM_MORE_ASSERTS != 0 ? "asserts:" G_STRINGIFY(NM_MORE_ASSERTS) ", " : "",
|
||||
nm_utils_boot_id_str());
|
||||
|
||||
nm_log_info(LOGD_CORE,
|
||||
"Read config: %s",
|
||||
|
|
|
|||
|
|
@ -2295,7 +2295,8 @@ static char *
|
|||
get_route_attributes_string(NMIPRoute *route, int family)
|
||||
{
|
||||
gs_free const char **names = NULL;
|
||||
GVariant *attr, *lock;
|
||||
GVariant *attr;
|
||||
GVariant *lock;
|
||||
GString *str;
|
||||
guint i, len;
|
||||
|
||||
|
|
@ -2335,12 +2336,12 @@ get_route_attributes_string(NMIPRoute *route, int family)
|
|||
names[i],
|
||||
(lock && g_variant_get_boolean(lock)) ? "lock " : "",
|
||||
g_variant_get_uint32(attr));
|
||||
} else if (strstr(names[i], "lock-")) {
|
||||
} else if (NM_STR_HAS_PREFIX(names[i], "lock-")) {
|
||||
const char *n = &(names[i])[NM_STRLEN("lock-")];
|
||||
|
||||
attr = nm_ip_route_get_attribute(route, n);
|
||||
if (!attr) {
|
||||
g_string_append_printf(str, "%s lock 0", n);
|
||||
if (!nm_ip_route_get_attribute(route, n)) {
|
||||
if (g_variant_get_boolean(attr))
|
||||
g_string_append_printf(str, "%s lock 0", n);
|
||||
} else {
|
||||
/* we also have a corresponding attribute with the numeric value. The
|
||||
* lock setting is handled above. */
|
||||
|
|
|
|||
|
|
@ -202,28 +202,25 @@ nm_uuid_is_valid_nm(const char *str,
|
|||
|
||||
/* @out_normalized_str is only set, if normalization was necessary
|
||||
* and possible. The caller cannot request @out_normalized_str, without
|
||||
* also getting @out_normalized. */
|
||||
* also requesting @out_normalized. Otherwise, they couldn't know whether
|
||||
* a normalized string was returned. */
|
||||
nm_assert(!out_normalized_str || out_normalized);
|
||||
|
||||
if (!str)
|
||||
return FALSE;
|
||||
|
||||
if (nm_uuid_parse_full(str, &uuid, &is_normalized)) {
|
||||
/* Note that:
|
||||
* @is_normalized means that "str" contains a normalized UUID
|
||||
* @out_normalized: indicates whether str requires normalization
|
||||
* and whether @out_normalized_str was set to contain the normalized
|
||||
* UUID.
|
||||
* With this, we get the slightly odd assignment: */
|
||||
NM_SET_OUT(out_normalized, !is_normalized);
|
||||
|
||||
if (!is_normalized && out_normalized_str) {
|
||||
/* we need to normalize the UUID */
|
||||
nm_uuid_unparse(&uuid, out_normalized_str);
|
||||
if (is_normalized) {
|
||||
/* @str is already normalized. No need to normalize again, so
|
||||
* @out_normalized is FALSE. */
|
||||
NM_SET_OUT(out_normalized, FALSE);
|
||||
} else {
|
||||
NM_SET_OUT(out_normalized, TRUE);
|
||||
if (out_normalized_str) {
|
||||
/* we need to normalize the UUID */
|
||||
nm_uuid_unparse(&uuid, out_normalized_str);
|
||||
}
|
||||
}
|
||||
|
||||
/* regardless whether normalization was necessary, the UUID is
|
||||
* essentially valid. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -235,24 +232,23 @@ nm_uuid_is_valid_nm(const char *str,
|
|||
* are made lower case first. */
|
||||
NM_SET_OUT(out_normalized, TRUE);
|
||||
if (out_normalized_str) {
|
||||
char str_lower[40 + 1];
|
||||
char str_lower[40];
|
||||
int i;
|
||||
|
||||
nm_assert(strlen(str) < G_N_ELEMENTS(str_lower));
|
||||
nm_assert(strlen(str) <= G_N_ELEMENTS(str_lower));
|
||||
|
||||
/* normalize first to lower-case. */
|
||||
for (i = 0; str[i]; i++) {
|
||||
nm_assert(i < G_N_ELEMENTS(str_lower));
|
||||
str_lower[i] = g_ascii_tolower(str[i]);
|
||||
}
|
||||
nm_assert(i < G_N_ELEMENTS(str_lower));
|
||||
str_lower[i] = '\0';
|
||||
nm_assert(i <= G_N_ELEMENTS(str_lower));
|
||||
|
||||
/* The namespace UUID is chosen randomly. */
|
||||
nm_uuid_generate_from_string(
|
||||
&uuid,
|
||||
str_lower,
|
||||
-1,
|
||||
i,
|
||||
NM_UUID_TYPE_VERSION5,
|
||||
&NM_UUID_INIT(4e, 72, f7, 09, ca, 95, 44, 05, 90, 53, 1f, 43, 29, 4a, 61, 8c));
|
||||
nm_uuid_unparse(&uuid, out_normalized_str);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue