summaryrefslogtreecommitdiff
path: root/libnm-core/nm-setting-private.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-01-04 11:28:27 +0100
committerThomas Haller <thaller@redhat.com>2019-01-07 10:54:28 +0100
commit7771473f46d30127075ebd5166d504a6197d8cdd (patch)
tree93a77be5c38d77d4825c97291b2964167f57d1dc /libnm-core/nm-setting-private.h
parent4a5514dc0fb6d3f9b07a14e0e7cda8800f476125 (diff)
downloadNetworkManager-7771473f46d30127075ebd5166d504a6197d8cdd.tar.gz
libnm,core: add _nm_connection_aggregate() to replace nm_connection_for_each_setting_value()
We should no longer use nm_connection_for_each_setting_value() and nm_setting_for_each_value(). It's fundamentally broken as it does not work with properties that are not backed by a GObject property and it cannot be fixed because it is public API. Add an internal function _nm_connection_aggregate() to replace it. Compare the implementation of the aggregation functionality inside libnm with the previous two checks for secret-flags that it replaces: - previous approach broke abstraction and require detailed knowledge of secret flags. Meaning, they must special case NMSettingVpn and GObject-property based secrets. If we implement a new way for implementing secrets (like we will need for WireGuard), then this the new way should only affect libnm-core, not require changes elsewhere. - it's very inefficient to itereate over all settings. It involves cloning and sorting the list of settings, and retrieve and clone all GObject properties. Only to look at secret properties alone. _nm_connection_aggregate() is supposed to be more flexible then just the two new aggregate types that perform a "find-any" search. The @arg argument and boolean return value can suffice to implement different aggregation types in the future. Also fixes the check of NMAgentManager for secret flags for VPNs (NM_CONNECTION_AGGREGATE_ANY_SYSTEM_SECRET_FLAGS). A secret for VPNs is a property that either has a secret or a secret-flag. The previous implementation would only look at present secrets and check their flags. It wouldn't check secret-flags that are NM_SETTING_SECRET_FLAG_NONE, but have no secret.
Diffstat (limited to 'libnm-core/nm-setting-private.h')
-rw-r--r--libnm-core/nm-setting-private.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-private.h b/libnm-core/nm-setting-private.h
index c5a11b7a02..49d27336fa 100644
--- a/libnm-core/nm-setting-private.h
+++ b/libnm-core/nm-setting-private.h
@@ -97,6 +97,13 @@ gboolean _nm_setting_verify_secret_string (const char *str,
const char *property,
GError **error);
+gboolean _nm_setting_aggregate (NMSetting *setting,
+ NMConnectionAggregateType type,
+ gpointer arg);
+gboolean _nm_setting_vpn_aggregate (NMSettingVpn *setting,
+ NMConnectionAggregateType type,
+ gpointer arg);
+
gboolean _nm_setting_slave_type_is_valid (const char *slave_type, const char **out_port_type);
GVariant *_nm_setting_to_dbus (NMSetting *setting,