diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h index 06e442f5f..5e5887922 100644 --- a/shared/nm-glib-aux/nm-shared-utils.h +++ b/shared/nm-glib-aux/nm-shared-utils.h @@ -122,7 +122,8 @@ typedef struct { /* NMIPAddr is really a union for IP addresses. * However, as ethernet addresses fit in here nicely, use * it also for an ethernet MAC address. */ - guint8 addr_eth[6 /*ETH_ALEN*/]; + guint8 ether_addr_octet[6 /*ETH_ALEN*/]; + NMEtherAddr ether_addr; guint8 array[sizeof(struct in6_addr)]; }; @@ -135,6 +136,8 @@ typedef struct { extern const NMIPAddr nm_ip_addr_zero; +#define nm_ether_addr_zero (nm_ip_addr_zero.ether_addr) + static inline int nm_ip_addr_cmp(int addr_family, gconstpointer a, gconstpointer b) { diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index ad91fd94d..3c27b349d 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -760,7 +760,7 @@ bridge_set_vlan_options(NMDevice *device, NMSettingBridge *s_bridge) hwaddr = nm_platform_link_get_address(plat, ifindex, &length); g_return_val_if_fail(length == ETH_ALEN, FALSE); - if (nm_utils_hwaddr_matches(hwaddr, ETH_ALEN, nm_ip_addr_zero.addr_eth, ETH_ALEN)) { + if (nm_utils_hwaddr_matches(hwaddr, length, &nm_ether_addr_zero, ETH_ALEN)) { /* We need a non-zero MAC address to set the default pvid. * Retry later. */ return TRUE; diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 7f239dcdc..2dab5075a 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -16808,8 +16808,8 @@ nm_device_update_hw_address(NMDevice *self) if (priv->type == NM_DEVICE_TYPE_ETHERNET && hwaddr && nm_utils_hwaddr_matches(hwaddr, hwaddrlen, - nm_ip_addr_zero.addr_eth, - sizeof(nm_ip_addr_zero.addr_eth))) + &nm_ether_addr_zero, + sizeof(nm_ether_addr_zero))) hwaddrlen = 0; if (!hwaddrlen) diff --git a/src/supplicant/nm-supplicant-interface.c b/src/supplicant/nm-supplicant-interface.c index 33807660d..1f6252f63 100644 --- a/src/supplicant/nm-supplicant-interface.c +++ b/src/supplicant/nm-supplicant-interface.c @@ -658,7 +658,7 @@ _bss_info_properties_changed(NMSupplicantInterface *self, v_v = nm_g_variant_lookup_value(properties, "BSSID", G_VARIANT_TYPE_BYTESTRING); if (v_v) { arr_data = g_variant_get_fixed_array(v_v, &arr_len, 1); - if (arr_len == ETH_ALEN && memcmp(arr_data, nm_ip_addr_zero.addr_eth, ETH_ALEN) != 0 + if (arr_len == ETH_ALEN && memcmp(arr_data, &nm_ether_addr_zero, ETH_ALEN) != 0 && memcmp(arr_data, (char[ETH_ALEN]){0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, ETH_ALEN) != 0) { /* pass */ @@ -881,7 +881,7 @@ _peer_info_properties_changed(NMSupplicantInterface *self, v_v = nm_g_variant_lookup_value(properties, "DeviceAddress", G_VARIANT_TYPE_BYTESTRING); if (v_v) { arr_data = g_variant_get_fixed_array(v_v, &arr_len, 1); - if (arr_len == ETH_ALEN && memcmp(arr_data, nm_ip_addr_zero.addr_eth, ETH_ALEN) != 0 + if (arr_len == ETH_ALEN && memcmp(arr_data, &nm_ether_addr_zero, ETH_ALEN) != 0 && memcmp(arr_data, (char[ETH_ALEN]){0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, ETH_ALEN) != 0) { /* pass */