libnm: don't set .direct_string_allow_empty for _nm_setting_property_define_direct_mac_address()

Most properties don't accept empty strings and reject them during
verify().

All _nm_setting_property_define_direct_mac_address() call
nm_utils_hwaddr_valid() on the string, which rejects empty strings.

Clear the .direct_string_allow_empty flag for those. The usage of the
flag is misleading.
This commit is contained in:
Thomas Haller 2024-01-08 12:28:02 +01:00
parent d8e51faee7
commit 8062d04cd4
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 0 additions and 7 deletions

View file

@ -1048,7 +1048,6 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
&nm_sett_info_propert_type_direct_mac_address, \
.direct_offset = \
NM_STRUCT_OFFSET_ENSURE_TYPE(char *, private_struct_type, private_struct_field), \
.direct_string_allow_empty = TRUE, \
__VA_ARGS__); \
} \
G_STMT_END

View file

@ -4743,12 +4743,6 @@ test_setting_metadata(void)
if (sip->direct_string_allow_empty) {
g_assert(sip->property_type->direct_type == NM_VALUE_TYPE_STRING);
}
if (!sip->direct_string_allow_empty
&& sip->property_type->direct_type == NM_VALUE_TYPE_STRING) {
g_error("currently all properties must have this set: FAIL: %s.%s",
nm_setting_get_name(setting),
sip->name);
}
if (sip->direct_set_string_mac_address_len != 0) {
g_assert(NM_IN_SET(sip->property_type,