summaryrefslogtreecommitdiff
path: root/libnm/nm-device-ethernet.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm/nm-device-ethernet.c')
-rw-r--r--libnm/nm-device-ethernet.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libnm/nm-device-ethernet.c b/libnm/nm-device-ethernet.c
index 4dfdcd840b..65906913ff 100644
--- a/libnm/nm-device-ethernet.c
+++ b/libnm/nm-device-ethernet.c
@@ -169,21 +169,20 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
if (s_wired) {
const GByteArray *mac;
- const char *perm_str;
- guint8 perm_mac[ETH_ALEN];
+ const char *perm_addr;
/* FIXME: filter using s390 subchannels when they are exported over the bus */
/* Check MAC address */
- perm_str = nm_device_ethernet_get_permanent_hw_address (NM_DEVICE_ETHERNET (device));
- if (perm_str) {
- if (!nm_utils_hwaddr_aton (perm_str, perm_mac, ETH_ALEN)) {
+ perm_addr = nm_device_ethernet_get_permanent_hw_address (NM_DEVICE_ETHERNET (device));
+ if (perm_addr) {
+ if (!nm_utils_hwaddr_valid (perm_addr, ETH_ALEN)) {
g_set_error (error, NM_DEVICE_ETHERNET_ERROR, NM_DEVICE_ETHERNET_ERROR_INVALID_DEVICE_MAC,
"Invalid device MAC address.");
return FALSE;
}
mac = nm_setting_wired_get_mac_address (s_wired);
- if (mac && memcmp (mac->data, perm_mac, ETH_ALEN)) {
+ if (mac && !nm_utils_hwaddr_matches (mac->data, mac->len, perm_addr, -1)) {
g_set_error (error, NM_DEVICE_ETHERNET_ERROR, NM_DEVICE_ETHERNET_ERROR_MAC_MISMATCH,
"The MACs of the device and the connection didn't match.");
return FALSE;