mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 22:40:10 +01:00
wifi: remove the MAC address check from complete_connection()
nm_device_complete_connection() now calls check_connection_compatible() which has a redundant check.
This commit is contained in:
parent
48710fbf8d
commit
3f5064371a
2 changed files with 10 additions and 42 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue