summaryrefslogtreecommitdiff
path: root/libnm-core/nm-setting-ip-config.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-core/nm-setting-ip-config.c')
-rw-r--r--libnm-core/nm-setting-ip-config.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c
index 09a3428362..b7a0ae9daf 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -1350,20 +1350,29 @@ nm_ip_route_attribute_validate (const char *name,
gboolean
_nm_ip_route_attribute_validate_all (const NMIPRoute *route)
{
- GHashTableIter iter;
- const char *key;
- GVariant *val;
+ NMUtilsNamedValue attrs_static[G_N_ELEMENTS (ip_route_attribute_spec)];
+ gs_free NMUtilsNamedValue *attrs_free = NULL;
+ const NMUtilsNamedValue *attrs;
+ guint attrs_len;
+ guint i;
g_return_val_if_fail (route, FALSE);
if (!route->attributes)
return TRUE;
- g_hash_table_iter_init (&iter, route->attributes);
- while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &val)) {
+ attrs = nm_utils_named_values_from_strdict (route->attributes,
+ &attrs_len,
+ attrs_static,
+ &attrs_free);
+ for (i = 0; i < attrs_len; i++) {
+ const char *key = attrs[i].name;
+ GVariant *val = attrs[i].value_ptr;
+
if (!nm_ip_route_attribute_validate (key, val, route->family, NULL, NULL))
return FALSE;
}
+
return TRUE;
}