device: replace static zero_hwaddr by nm_ip_addr_zero.addr_eth
Instead of defining multiple all-zero-ethernet-address variables, use nm_ip_addr_zero.addr_eth.
This commit is contained in:
@@ -1582,7 +1582,6 @@ link_changed (NMDevice *device, NMPlatformLink *info)
|
||||
{
|
||||
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
static const guint8 zero_hwaddr[ETH_ALEN];
|
||||
const guint8 *hwaddr;
|
||||
gsize hwaddrlen = 0;
|
||||
|
||||
@@ -1594,7 +1593,7 @@ link_changed (NMDevice *device, NMPlatformLink *info)
|
||||
hwaddr = nm_platform_link_get_address (NM_PLATFORM_GET,
|
||||
nm_device_get_ifindex (self),
|
||||
&hwaddrlen);
|
||||
if (!nm_utils_hwaddr_matches (hwaddr, hwaddrlen, zero_hwaddr, ETH_ALEN)) {
|
||||
if (!nm_utils_hwaddr_matches (hwaddr, hwaddrlen, nm_ip_addr_zero.addr_eth, sizeof (nm_ip_addr_zero.addr_eth))) {
|
||||
_LOGD (LOGD_DEVICE, "device got a valid hw address");
|
||||
nm_device_update_hw_address (self);
|
||||
nm_device_update_initial_hw_address (self);
|
||||
|
@@ -11251,7 +11251,6 @@ nm_device_update_hw_address (NMDevice *self)
|
||||
int ifindex = nm_device_get_ifindex (self);
|
||||
const guint8 *hwaddr;
|
||||
gsize hwaddrlen = 0;
|
||||
static const guint8 zero_hwaddr[ETH_ALEN];
|
||||
|
||||
if (ifindex <= 0)
|
||||
return;
|
||||
@@ -11259,7 +11258,7 @@ nm_device_update_hw_address (NMDevice *self)
|
||||
hwaddr = nm_platform_link_get_address (NM_PLATFORM_GET, ifindex, &hwaddrlen);
|
||||
|
||||
if ( priv->type == NM_DEVICE_TYPE_ETHERNET
|
||||
&& nm_utils_hwaddr_matches (hwaddr, hwaddrlen, zero_hwaddr, sizeof (zero_hwaddr)))
|
||||
&& nm_utils_hwaddr_matches (hwaddr, hwaddrlen, nm_ip_addr_zero.addr_eth, sizeof (nm_ip_addr_zero.addr_eth)))
|
||||
hwaddrlen = 0;
|
||||
|
||||
if (hwaddrlen) {
|
||||
|
Reference in New Issue
Block a user