summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Giudici <fgiudici@redhat.com>2016-07-22 14:49:31 +0200
committerFrancesco Giudici <fgiudici@redhat.com>2016-07-22 19:36:24 +0200
commit60a82e3ff27777c1fb5fc7e965d64138258df770 (patch)
tree743454993d050fce2cbad0f5aaecf7466951b127
parentddc35f27eb2594d924755f2fc0ff39f4352a2a0c (diff)
downloadNetworkManager-fg/mac_fixes.tar.gz
device: enable MAC address check on virtual devicesfg/mac_fixes
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.
-rw-r--r--libnm/nm-device-ethernet.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libnm/nm-device-ethernet.c b/libnm/nm-device-ethernet.c
index 65d28d0332..825ed7b392 100644
--- a/libnm/nm-device-ethernet.c
+++ b/libnm/nm-device-ethernet.c
@@ -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);