From 60a82e3ff27777c1fb5fc7e965d64138258df770 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Fri, 22 Jul 2016 14:49:31 +0200 Subject: 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. --- libnm/nm-device-ethernet.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libnm/nm-device-ethernet.c') 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); -- cgit v1.2.1