shared: add ether_addr field of type NMEtherAddr to NMIPAddr union
This commit is contained in:
@@ -122,7 +122,8 @@ typedef struct {
|
|||||||
/* NMIPAddr is really a union for IP addresses.
|
/* NMIPAddr is really a union for IP addresses.
|
||||||
* However, as ethernet addresses fit in here nicely, use
|
* However, as ethernet addresses fit in here nicely, use
|
||||||
* it also for an ethernet MAC address. */
|
* 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)];
|
guint8 array[sizeof(struct in6_addr)];
|
||||||
};
|
};
|
||||||
@@ -135,6 +136,8 @@ typedef struct {
|
|||||||
|
|
||||||
extern const NMIPAddr nm_ip_addr_zero;
|
extern const NMIPAddr nm_ip_addr_zero;
|
||||||
|
|
||||||
|
#define nm_ether_addr_zero (nm_ip_addr_zero.ether_addr)
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
nm_ip_addr_cmp(int addr_family, gconstpointer a, gconstpointer b)
|
nm_ip_addr_cmp(int addr_family, gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
|
@@ -760,7 +760,7 @@ bridge_set_vlan_options(NMDevice *device, NMSettingBridge *s_bridge)
|
|||||||
|
|
||||||
hwaddr = nm_platform_link_get_address(plat, ifindex, &length);
|
hwaddr = nm_platform_link_get_address(plat, ifindex, &length);
|
||||||
g_return_val_if_fail(length == ETH_ALEN, FALSE);
|
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.
|
/* We need a non-zero MAC address to set the default pvid.
|
||||||
* Retry later. */
|
* Retry later. */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -16808,8 +16808,8 @@ nm_device_update_hw_address(NMDevice *self)
|
|||||||
if (priv->type == NM_DEVICE_TYPE_ETHERNET && hwaddr
|
if (priv->type == NM_DEVICE_TYPE_ETHERNET && hwaddr
|
||||||
&& nm_utils_hwaddr_matches(hwaddr,
|
&& nm_utils_hwaddr_matches(hwaddr,
|
||||||
hwaddrlen,
|
hwaddrlen,
|
||||||
nm_ip_addr_zero.addr_eth,
|
&nm_ether_addr_zero,
|
||||||
sizeof(nm_ip_addr_zero.addr_eth)))
|
sizeof(nm_ether_addr_zero)))
|
||||||
hwaddrlen = 0;
|
hwaddrlen = 0;
|
||||||
|
|
||||||
if (!hwaddrlen)
|
if (!hwaddrlen)
|
||||||
|
@@ -658,7 +658,7 @@ _bss_info_properties_changed(NMSupplicantInterface *self,
|
|||||||
v_v = nm_g_variant_lookup_value(properties, "BSSID", G_VARIANT_TYPE_BYTESTRING);
|
v_v = nm_g_variant_lookup_value(properties, "BSSID", G_VARIANT_TYPE_BYTESTRING);
|
||||||
if (v_v) {
|
if (v_v) {
|
||||||
arr_data = g_variant_get_fixed_array(v_v, &arr_len, 1);
|
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)
|
&& memcmp(arr_data, (char[ETH_ALEN]){0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, ETH_ALEN)
|
||||||
!= 0) {
|
!= 0) {
|
||||||
/* pass */
|
/* pass */
|
||||||
@@ -881,7 +881,7 @@ _peer_info_properties_changed(NMSupplicantInterface *self,
|
|||||||
v_v = nm_g_variant_lookup_value(properties, "DeviceAddress", G_VARIANT_TYPE_BYTESTRING);
|
v_v = nm_g_variant_lookup_value(properties, "DeviceAddress", G_VARIANT_TYPE_BYTESTRING);
|
||||||
if (v_v) {
|
if (v_v) {
|
||||||
arr_data = g_variant_get_fixed_array(v_v, &arr_len, 1);
|
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)
|
&& memcmp(arr_data, (char[ETH_ALEN]){0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, ETH_ALEN)
|
||||||
!= 0) {
|
!= 0) {
|
||||||
/* pass */
|
/* pass */
|
||||||
|
Reference in New Issue
Block a user