SAE: Send external auth failure status to driver

wpa_supplicant prepares auth commit request as part of the external
authentication (first SAE authentication frame), but it fails to get
prepared when wpa_supplicant is started without mentioning the SAE
password in configuration. Send this failure status to the driver to
make it aware that the external authentication has been aborted by
wpa_supplicant.

Signed-off-by: Srinivas Dasari <dasaris@codeaurora.org>
This commit is contained in:
Srinivas Dasari 2019-05-16 14:51:36 +05:30 committed by Jouni Malinen
parent 2552a3735a
commit fb6ebd1ced

View file

@ -932,21 +932,23 @@ static int sme_external_auth_build_buf(struct wpabuf *buf,
}
static void sme_external_auth_send_sae_commit(struct wpa_supplicant *wpa_s,
const u8 *bssid,
struct wpa_ssid *ssid)
static int sme_external_auth_send_sae_commit(struct wpa_supplicant *wpa_s,
const u8 *bssid,
struct wpa_ssid *ssid)
{
struct wpabuf *resp, *buf;
resp = sme_auth_build_sae_commit(wpa_s, ssid, bssid, 1, 0);
if (!resp)
return;
if (!resp) {
wpa_printf(MSG_DEBUG, "SAE: Failed to build SAE commit");
return -1;
}
wpa_s->sme.sae.state = SAE_COMMITTED;
buf = wpabuf_alloc(4 + SAE_COMMIT_MAX_LEN + wpabuf_len(resp));
if (!buf) {
wpabuf_free(resp);
return;
return -1;
}
wpa_s->sme.seq_num++;
@ -955,6 +957,8 @@ static void sme_external_auth_send_sae_commit(struct wpa_supplicant *wpa_s,
wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1, 0);
wpabuf_free(resp);
wpabuf_free(buf);
return 0;
}
@ -972,8 +976,8 @@ static void sme_send_external_auth_status(struct wpa_supplicant *wpa_s,
}
static void sme_handle_external_auth_start(struct wpa_supplicant *wpa_s,
union wpa_event_data *data)
static int sme_handle_external_auth_start(struct wpa_supplicant *wpa_s,
union wpa_event_data *data)
{
struct wpa_ssid *ssid;
size_t ssid_str_len = data->external_auth.ssid_len;
@ -987,13 +991,12 @@ static void sme_handle_external_auth_start(struct wpa_supplicant *wpa_s,
(ssid->key_mgmt & (WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_FT_SAE)))
break;
}
if (ssid)
sme_external_auth_send_sae_commit(wpa_s,
data->external_auth.bssid,
ssid);
else
sme_send_external_auth_status(wpa_s,
WLAN_STATUS_UNSPECIFIED_FAILURE);
if (!ssid ||
sme_external_auth_send_sae_commit(wpa_s, data->external_auth.bssid,
ssid) < 0)
return -1;
return 0;
}
@ -1043,7 +1046,9 @@ void sme_external_auth_trigger(struct wpa_supplicant *wpa_s,
wpa_s->sme.sae.state = SAE_NOTHING;
wpa_s->sme.sae.send_confirm = 0;
wpa_s->sme.sae_group_index = 0;
sme_handle_external_auth_start(wpa_s, data);
if (sme_handle_external_auth_start(wpa_s, data) < 0)
sme_send_external_auth_status(wpa_s,
WLAN_STATUS_UNSPECIFIED_FAILURE);
} else if (data->external_auth.action == EXT_AUTH_ABORT) {
/* Report failure to driver for the wrong trigger */
sme_send_external_auth_status(wpa_s,