Commit 4f8b45e8 authored by Thomas Haller's avatar Thomas Haller

libnm-core: allow nm_setting_verify() to succeed individually without @all_settings

When calling nm_setting_verify() without providing any settings in @all_settings,
we assume that the setting on its own might be valid.
Only when checked together with all settings, we want to consider the setting
in the full context. nm_connection_verify() ensures to pass on a list of settings.
Signed-off-by: Thomas Haller's avatarThomas Haller <>
parent 66d88dc0
......@@ -566,7 +566,8 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
/* If parent is NULL, the parent must be specified via
* NMSettingWired:mac-address.
if (!s_wired || !nm_setting_wired_get_mac_address (s_wired)) {
if ( all_settings
&& (!s_wired || !nm_setting_wired_get_mac_address (s_wired))) {
g_set_error (error,
......@@ -1413,6 +1413,22 @@ _nm_setting_verify_deprecated_virtual_iface_name (const char *interface_name,
NMSettingConnection *s_con;
const char *con_name;
if (!all_settings) {
/* nm_setting_verify() was called without passing on any other settings.
* Perform a relaxed verification, the setting might be valid when checked
* together with a NMSettingConnection as part of a NMConnection. */
if (interface_name && !nm_utils_iface_valid_name (interface_name)) {
/* Only if the interace name is invalid, there is an normalizable warning */
g_set_error_literal (error,
_("property is invalid"));
g_prefix_error (error, "%s.%s: ", setting_name, setting_property);
s_con = NM_SETTING_CONNECTION (nm_setting_find_in_list (all_settings, NM_SETTING_CONNECTION_SETTING_NAME));
con_name = s_con ? nm_setting_connection_get_interface_name (s_con) : NULL;
if (!interface_name && !con_name) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment