summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-10-12 12:00:58 -0500
committerDan Williams <dcbw@redhat.com>2014-12-11 09:44:16 -0600
commit61fd76e8c30fcfcecbc34fcf5075129ea927a957 (patch)
treed3f2a184e4f8a92581e4ae2d77299dba5534feb2
parent47aef240facc913633d1cdf5bc061d15d7fdab38 (diff)
downloadNetworkManager-61fd76e8c30fcfcecbc34fcf5075129ea927a957.tar.gz
fixup! core: move permanent and initial MAC address reading to NMDevice and NMPlatform
-rw-r--r--src/devices/nm-device-ethernet.c28
-rw-r--r--src/devices/wifi/nm-device-wifi.c28
2 files changed, 30 insertions, 26 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index e3f664cb50..e127f61bc2 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -383,22 +383,24 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
return FALSE;
perm_hw_addr = nm_device_get_permanent_hw_address (device);
-
mac = nm_setting_wired_get_mac_address (s_wired);
- if (try_mac && mac && perm_hw_addr && !nm_utils_hwaddr_matches (mac, -1, perm_hw_addr, -1))
- return FALSE;
-
- /* Check for MAC address blacklist */
- mac_blacklist = nm_setting_wired_get_mac_address_blacklist (s_wired);
- for (i = 0; mac_blacklist[i]; i++) {
- if (!nm_utils_hwaddr_valid (mac_blacklist[i], ETH_ALEN)) {
- g_warn_if_reached ();
+ if (perm_hw_addr) {
+ if (try_mac && mac && !nm_utils_hwaddr_matches (mac, -1, perm_hw_addr, -1))
return FALSE;
- }
- if (perm_hw_addr && nm_utils_hwaddr_matches (mac_blacklist[i], -1, perm_hw_addr, -1))
- return FALSE;
- }
+ /* Check for MAC address blacklist */
+ mac_blacklist = nm_setting_wired_get_mac_address_blacklist (s_wired);
+ for (i = 0; mac_blacklist[i]; i++) {
+ if (!nm_utils_hwaddr_valid (mac_blacklist[i], ETH_ALEN)) {
+ g_warn_if_reached ();
+ return FALSE;
+ }
+
+ if (nm_utils_hwaddr_matches (mac_blacklist[i], -1, perm_hw_addr, -1))
+ return FALSE;
+ }
+ } else if (mac)
+ return FALSE;
}
return TRUE;
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index b0d2f654be..3ee2c78ac2 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -813,22 +813,24 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
return FALSE;
perm_hw_addr = nm_device_get_permanent_hw_address (device);
-
mac = nm_setting_wireless_get_mac_address (s_wireless);
- if (mac && perm_hw_addr && !nm_utils_hwaddr_matches (mac, -1, perm_hw_addr, -1))
- return FALSE;
-
- /* Check for MAC address blacklist */
- mac_blacklist = nm_setting_wireless_get_mac_address_blacklist (s_wireless);
- for (i = 0; mac_blacklist[i]; i++) {
- if (!nm_utils_hwaddr_valid (mac_blacklist[i], ETH_ALEN)) {
- g_warn_if_reached ();
+ if (perm_hw_addr) {
+ if (mac && !nm_utils_hwaddr_matches (mac, -1, perm_hw_addr, -1))
return FALSE;
- }
- if (perm_hw_addr && nm_utils_hwaddr_matches (mac_blacklist[i], -1, perm_hw_addr, -1))
- return FALSE;
- }
+ /* Check for MAC address blacklist */
+ mac_blacklist = nm_setting_wireless_get_mac_address_blacklist (s_wireless);
+ for (i = 0; mac_blacklist[i]; i++) {
+ if (!nm_utils_hwaddr_valid (mac_blacklist[i], ETH_ALEN)) {
+ g_warn_if_reached ();
+ return FALSE;
+ }
+
+ if (nm_utils_hwaddr_matches (mac_blacklist[i], -1, perm_hw_addr, -1))
+ return FALSE;
+ }
+ } else if (mac)
+ return FALSE;
if (is_adhoc_wpa (connection))
return FALSE;