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:
Thomas Haller
2016-05-24 11:28:44 +02:00
parent 82f2fbf78d
commit 4c7fbcc941
2 changed files with 2 additions and 4 deletions

View File

@@ -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);

View File

@@ -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) {