diff options
Diffstat (limited to 'src/libnm-core-impl/nm-setting.c')
| -rw-r--r-- | src/libnm-core-impl/nm-setting.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/libnm-core-impl/nm-setting.c b/src/libnm-core-impl/nm-setting.c index 8bc7b4bf..bbaa6fcd 100644 --- a/src/libnm-core-impl/nm-setting.c +++ b/src/libnm-core-impl/nm-setting.c @@ -8,6 +8,8 @@ #include "nm-setting.h" +#include <linux/if_ether.h> + #include "libnm-core-intern/nm-core-internal.h" #include "libnm-glib-aux/nm-ref-string.h" #include "libnm-glib-aux/nm-secret-utils.h" @@ -739,10 +741,29 @@ _property_direct_set_strv(const NMSettInfoSetting *sett_info, if (!property_info->direct_strv_preserve_empty && strv && !strv[0]) strv = NULL; - if (nm_strvarray_equal_strv(p_val->arr, strv, -1)) - return FALSE; + if (property_info->direct_set_strv_normalize_hwaddr) { + gs_unref_array GArray *arr = NULL; + if (strv) { + nm_strvarray_ensure(&arr); + + for (; strv[0]; strv++) { + nm_strvarray_add_take(arr, + _nm_utils_hwaddr_canonical_or_invalid(strv[0], ETH_ALEN)); + } + } + + if (nm_strvarray_equal(p_val->arr, arr)) + return FALSE; + NM_SWAP(&p_val->arr, &arr); + return TRUE; + } + + if (nm_strvarray_equal_strv(p_val->arr, strv, -1)) { + return FALSE; + } nm_strvarray_set_strv_full(&p_val->arr, strv, property_info->direct_strv_preserve_empty); + return TRUE; } @@ -844,7 +865,7 @@ _nm_setting_property_get_property_direct(GObject *object, value, nm_strvarray_get_strv_full_dup(p_val->arr, NULL, - FALSE, + property_info->direct_strv_not_null, property_info->direct_strv_preserve_empty)); return; } @@ -2711,7 +2732,9 @@ _nm_setting_property_compare_fcn_direct(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm_ _nm_setting_property_to_dbus_fcn_direct_mac_address, _nm_setting_connection_controller_to_dbus, _nm_setting_connection_port_type_to_dbus, - _nm_setting_connection_autoconnect_ports_to_dbus)); + _nm_setting_connection_autoconnect_ports_to_dbus, + _nm_setting_wireless_mac_denylist_to_dbus, + _nm_setting_wired_mac_denylist_to_dbus)); if (!property_info->param_spec) return nm_assert_unreachable_val(NM_TERNARY_DEFAULT); |