Commit 344a7024 authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by Kalle Valo

wil6210: track privacy connection attribute

For the STA interface, track 'privacy'.
Refactor safety checks to:
- always print connection params
- always check IE size validity
- require RSN IE for secure connection
Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 774974e5
...@@ -387,11 +387,25 @@ static int wil_cfg80211_connect(struct wiphy *wiphy, ...@@ -387,11 +387,25 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,
int ch; int ch;
int rc = 0; int rc = 0;
wil_print_connect_params(wil, sme);
if (test_bit(wil_status_fwconnecting, wil->status) || if (test_bit(wil_status_fwconnecting, wil->status) ||
test_bit(wil_status_fwconnected, wil->status)) test_bit(wil_status_fwconnected, wil->status))
return -EALREADY; return -EALREADY;
wil_print_connect_params(wil, sme); if (sme->ie_len > WMI_MAX_IE_LEN) {
wil_err(wil, "IE too large (%td bytes)\n", sme->ie_len);
return -ERANGE;
}
rsn_eid = sme->ie ?
cfg80211_find_ie(WLAN_EID_RSN, sme->ie, sme->ie_len) :
NULL;
if (sme->privacy && !rsn_eid) {
wil_err(wil, "Missing RSN IE for secure connection\n");
return -EINVAL;
}
bss = cfg80211_get_bss(wiphy, sme->channel, sme->bssid, bss = cfg80211_get_bss(wiphy, sme->channel, sme->bssid,
sme->ssid, sme->ssid_len, sme->ssid, sme->ssid_len,
...@@ -407,17 +421,9 @@ static int wil_cfg80211_connect(struct wiphy *wiphy, ...@@ -407,17 +421,9 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,
rc = -ENOENT; rc = -ENOENT;
goto out; goto out;
} }
wil->privacy = sme->privacy;
rsn_eid = sme->ie ? if (wil->privacy) {
cfg80211_find_ie(WLAN_EID_RSN, sme->ie, sme->ie_len) :
NULL;
if (rsn_eid) {
if (sme->ie_len > WMI_MAX_IE_LEN) {
rc = -ERANGE;
wil_err(wil, "IE too large (%td bytes)\n",
sme->ie_len);
goto out;
}
/* For secure assoc, send WMI_DELETE_CIPHER_KEY_CMD */ /* For secure assoc, send WMI_DELETE_CIPHER_KEY_CMD */
rc = wmi_del_cipher_key(wil, 0, bss->bssid); rc = wmi_del_cipher_key(wil, 0, bss->bssid);
if (rc) { if (rc) {
...@@ -450,7 +456,7 @@ static int wil_cfg80211_connect(struct wiphy *wiphy, ...@@ -450,7 +456,7 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,
bss->capability); bss->capability);
goto out; goto out;
} }
if (rsn_eid) { if (wil->privacy) {
conn.dot11_auth_mode = WMI_AUTH11_SHARED; conn.dot11_auth_mode = WMI_AUTH11_SHARED;
conn.auth_mode = WMI_AUTH_WPA2_PSK; conn.auth_mode = WMI_AUTH_WPA2_PSK;
conn.pairwise_crypto_type = WMI_CRYPT_AES_GCMP; conn.pairwise_crypto_type = WMI_CRYPT_AES_GCMP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment