diff --git a/src/libnm-core-impl/nm-setting-connection.c b/src/libnm-core-impl/nm-setting-connection.c index 892e7d3151..8066cb0930 100644 --- a/src/libnm-core-impl/nm-setting-connection.c +++ b/src/libnm-core-impl/nm-setting-connection.c @@ -2458,7 +2458,8 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass) NMSettingConnectionPrivate, controller, .direct_string_allow_empty = TRUE, - .is_deprecated = TRUE); + .is_deprecated = TRUE, + .direct_is_aliased_field = TRUE, ); /** * NMSettingConnection:controller: @@ -2518,8 +2519,9 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass) _nm_setting_connection_slave_type_from_dbus, ), NMSettingConnectionPrivate, port_type, - .is_deprecated = 1, - .direct_string_allow_empty = TRUE); + .is_deprecated = TRUE, + .direct_string_allow_empty = TRUE, + .direct_is_aliased_field = TRUE, ); /** * NMSettingConnection:port-type: diff --git a/src/libnm-core-impl/nm-setting.c b/src/libnm-core-impl/nm-setting.c index 758338e5ce..a51d0a228a 100644 --- a/src/libnm-core-impl/nm-setting.c +++ b/src/libnm-core-impl/nm-setting.c @@ -1077,7 +1077,7 @@ _init_direct(NMSetting *setting) int def_val; def_val = NM_G_PARAM_SPEC_GET_DEFAULT_ENUM(property_info->param_spec); - nm_assert(*p_val == 0); + nm_assert(NM_IN_SET(*p_val, 0, property_info->direct_is_aliased_field ? def_val : 0)); *p_val = def_val; break; } diff --git a/src/libnm-core-intern/nm-core-internal.h b/src/libnm-core-intern/nm-core-internal.h index 8e2573370b..dedc90b240 100644 --- a/src/libnm-core-intern/nm-core-internal.h +++ b/src/libnm-core-intern/nm-core-internal.h @@ -907,6 +907,14 @@ struct _NMSettInfoProperty { * is not deprecated. This flag is about the deprecation of the D-Bus representation * of a property. */ bool dbus_deprecated : 1; + + /* Whether the property is an alias. + * + * This flag indicates whether a property is an alias of another. This is used + * during _init_direct() to allow two or more properties to set the value of + * the same field. + */ + bool direct_is_aliased_field : 1; }; typedef struct {