ifcfg-rh: in get_route_attributes_string() check prefix for "lock" names

In practice, the profile probably validates, so all the
attribute names are well-known. There is thus no attribute
name that has "lock-" in the middle of the string.

Still, fix it. We want to match only at the begin of the
name.
This commit is contained in:
Thomas Haller 2022-06-24 12:53:05 +02:00
parent 3628cf4805
commit efca0b8fa6
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -2335,7 +2335,7 @@ 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);