core: call is_adhoc_wpa() only after we check '802-11-wireless' setting

This prevents assertion while checking a connection that is not a wireless one.
This commit is contained in:
Jiří Klimeš 2012-04-02 12:28:05 +02:00
parent 02482101ff
commit 47f9eb80d8

View file

@ -1014,14 +1014,6 @@ real_check_connection_compatible (NMDevice *device,
const GByteArray *mac;
const GSList *mac_blacklist, *mac_blacklist_iter;
if (is_adhoc_wpa (connection)) {
g_set_error_literal (error,
NM_WIFI_ERROR,
NM_WIFI_ERROR_CONNECTION_INCOMPATIBLE,
"WPA Ad-Hoc disabled due to kernel bugs");
return FALSE;
}
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
@ -1040,6 +1032,7 @@ real_check_connection_compatible (NMDevice *device,
return FALSE;
}
mac = nm_setting_wireless_get_mac_address (s_wireless);
if (mac && memcmp (mac->data, &priv->perm_hw_addr, ETH_ALEN)) {
g_set_error (error,
@ -1067,6 +1060,14 @@ real_check_connection_compatible (NMDevice *device,
}
}
if (is_adhoc_wpa (connection)) {
g_set_error_literal (error,
NM_WIFI_ERROR,
NM_WIFI_ERROR_CONNECTION_INCOMPATIBLE,
"WPA Ad-Hoc disabled due to kernel bugs");
return FALSE;
}
// FIXME: check channel/freq/band against bands the hardware supports
// FIXME: check encryption against device capabilities
// FIXME: check bitrate against device capabilities