core: fall back to current MAC address if permanent one is invalid

Not all drivers will return errors when even when they don't provide
the GPERMADDR ethtool call; sometimes you'll get 00:00:00:00:00:00
which is clearly not right.  In this case, fall back to the current
HW address just like if the ethtool GPERMADDR call failed.
This commit is contained in:
Dan Williams 2010-06-24 15:18:53 -07:00
parent 88eb6ced3f
commit 157959a1c5
2 changed files with 2 additions and 2 deletions

View file

@ -609,7 +609,7 @@ real_update_permanent_hw_address (NMDevice *dev)
errno = 0;
ret = ioctl (fd, SIOCETHTOOL, &req);
if (ret < 0) {
if ((ret < 0) || !nm_ethernet_address_is_valid ((struct ether_addr *) epaddr->data)) {
nm_log_err (LOGD_HW | LOGD_ETHER, "(%s): unable to read permanent MAC address (error %d)",
nm_device_get_iface (dev), errno);
/* Fall back to current address */

View file

@ -3032,7 +3032,7 @@ real_update_permanent_hw_address (NMDevice *dev)
errno = 0;
ret = ioctl (fd, SIOCETHTOOL, &req);
if (ret < 0) {
if ((ret < 0) || !nm_ethernet_address_is_valid ((struct ether_addr *) epaddr->data)) {
nm_log_err (LOGD_HW | LOGD_ETHER, "(%s): unable to read permanent MAC address (error %d)",
nm_device_get_iface (dev), errno);
/* Fall back to current address */