mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 06:40:16 +01:00
ifcfg-rh: fix serializing lock route attributes
The lock attribute is a boolean, it can also be FALSE. We need to handle that case, and don't add serialize "$NAME lock 0" for them.
This commit is contained in:
parent
efca0b8fa6
commit
ae6fe90851
1 changed files with 5 additions and 4 deletions
|
|
@ -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;
|
||||
|
||||
|
|
@ -2338,9 +2339,9 @@ get_route_attributes_string(NMIPRoute *route, int family)
|
|||
} 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. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue