summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-05-07 11:51:16 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-05-07 18:30:06 +0200
commit29b93339f14730c407d0332563382e17827f4b0d (patch)
tree4ed5f9fe6acde5bcdb59e945e69b00ba1e4c729d
parent9db498336c773327dcbb1fd6dc81045eb3acd09e (diff)
downloadNetworkManager-29b93339f14730c407d0332563382e17827f4b0d.tar.gz
wifi: remove the MAC address check from complete_connection()
nm_device_complete_connection() now calls check_connection_compatible() which has a redundant check.
-rw-r--r--src/devices/wifi/nm-device-iwd.c34
-rw-r--r--src/devices/wifi/nm-device-wifi.c18
2 files changed, 10 insertions, 42 deletions
diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c
index da7d06855a..45e50235f4 100644
--- a/src/devices/wifi/nm-device-iwd.c
+++ b/src/devices/wifi/nm-device-iwd.c
@@ -780,7 +780,6 @@ complete_connection (NMDevice *device,
NMDeviceIwd *self = NM_DEVICE_IWD (device);
NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE (self);
NMSettingWireless *s_wifi;
- const char *setting_mac;
gs_free char *ssid_utf8 = NULL;
NMWifiAP *ap;
GBytes *ssid;
@@ -878,30 +877,17 @@ complete_connection (NMDevice *device,
TRUE);
perm_hw_addr = nm_device_get_permanent_hw_address (device);
- if (perm_hw_addr) {
- setting_mac = nm_setting_wireless_get_mac_address (s_wifi);
- if (setting_mac) {
- /* Make sure the setting MAC (if any) matches the device's permanent MAC */
- if (!nm_utils_hwaddr_matches (setting_mac, -1, perm_hw_addr, -1)) {
- g_set_error_literal (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- "connection does not match device");
- g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_MAC_ADDRESS);
- return FALSE;
- }
- } else {
- guint8 tmp[ETH_ALEN];
+ if (perm_hw_addr && !nm_setting_wireless_get_mac_address (s_wifi))
+ guint8 tmp[ETH_ALEN];
- /* Lock the connection to this device by default if it uses a
- * permanent MAC address (ie not a 'locally administered' one)
- */
- nm_utils_hwaddr_aton (perm_hw_addr, tmp, ETH_ALEN);
- if (!(tmp[0] & 0x02)) {
- g_object_set (G_OBJECT (s_wifi),
- NM_SETTING_WIRELESS_MAC_ADDRESS, perm_hw_addr,
- NULL);
- }
+ /* Lock the connection to this device by default if it uses a
+ * permanent MAC address (ie not a 'locally administered' one)
+ */
+ nm_utils_hwaddr_aton (perm_hw_addr, tmp, ETH_ALEN);
+ if (!(tmp[0] & 0x02)) {
+ g_object_set (G_OBJECT (s_wifi),
+ NM_SETTING_WIRELESS_MAC_ADDRESS, perm_hw_addr,
+ NULL);
}
}
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 3a58c62031..7aa5445e9c 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -778,13 +778,11 @@ complete_connection (NMDevice *device,
NMDeviceWifi *self = NM_DEVICE_WIFI (device);
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
NMSettingWireless *s_wifi;
- const char *setting_mac;
gs_free char *ssid_utf8 = NULL;
NMWifiAP *ap;
GBytes *ssid = NULL;
GBytes *setting_ssid = NULL;
gboolean hidden = FALSE;
- const char *perm_hw_addr;
const char *mode;
s_wifi = nm_connection_get_setting_wireless (connection);
@@ -913,22 +911,6 @@ complete_connection (NMDevice *device,
if (hidden)
g_object_set (s_wifi, NM_SETTING_WIRELESS_HIDDEN, TRUE, NULL);
- perm_hw_addr = nm_device_get_permanent_hw_address (device);
- if (perm_hw_addr) {
- setting_mac = nm_setting_wireless_get_mac_address (s_wifi);
- if (setting_mac) {
- /* Make sure the setting MAC (if any) matches the device's permanent MAC */
- if (!nm_utils_hwaddr_matches (setting_mac, -1, perm_hw_addr, -1)) {
- g_set_error_literal (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("connection does not match device"));
- g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_MAC_ADDRESS);
- return FALSE;
- }
- }
- }
-
return TRUE;
}