device: enable MAC address check on virtual devices

Virtual devices don't have a valid permanent hw address: when activating
a connection against a specific interface, a check is performed on the
device MAC address too: if it is an empty string, give a try to the
currently assigned MAC address.
This commit is contained in:
Francesco Giudici 2016-07-22 14:49:31 +02:00
parent ddc35f27eb
commit 60a82e3ff2

View file

@ -227,6 +227,11 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
perm_addr = nm_device_ethernet_get_permanent_hw_address (NM_DEVICE_ETHERNET (device));
s_mac = nm_setting_wired_get_mac_address (s_wired);
if (perm_addr) {
/* Virtual devices will have empty permanent addr but they should not be excluded
* from the MAC address check specified in the connection */
if (*perm_addr == 0)
perm_addr = nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (device));
if (!nm_utils_hwaddr_valid (perm_addr, ETH_ALEN)) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
_("Invalid device MAC address %s."), perm_addr);