From 62f2c4cf20b02017742968a3aba493f92c9d9d3d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 15 Sep 2017 18:33:44 +0200 Subject: ifcfg-rh: write lock route attribute with zero value Only specifying "lock" without a corresponding attribute shall have the meaning of "$NAME lock 0". --- src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index c1b927aadf..2f4c58e040 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -1891,7 +1891,17 @@ get_route_attributes_string (NMIPRoute *route, int family) (lock && g_variant_get_boolean (lock)) ? "lock " : "", g_variant_get_uint32 (attr)); } else if (strstr (names[i], "lock-")) { - /* handled above */ + 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); + } else { + /* we also have a corresponding attribute with the numeric value. The + * lock setting is handled above. */ + } } else if (nm_streq (names[i], NM_IP_ROUTE_ATTRIBUTE_TOS)) { g_string_append_printf (str, "%s 0x%02x", names[i], (unsigned) g_variant_get_byte (attr)); } else if ( nm_streq (names[i], NM_IP_ROUTE_ATTRIBUTE_SRC) -- cgit v1.2.1