Skip to content

Commit aa0237b

Browse files
JordanYatesseyoungjeong
authored andcommitted
modules: hostap: fix connection termination report
If the disconnect event is raised before the network has been connected, report the connection result as `WIFI_STATUS_CONN_FAIL`, instead of as `WIFI_REASON_DISCONN_SUCCESS`, which is interpretted as `WIFI_STATUS_CONN_SUCCESS`. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent f1ef30d commit aa0237b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/hostap/src/supp_events.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,20 +224,24 @@ int supplicant_send_wifi_mgmt_conn_event(void *ctx, int status_code)
224224
int supplicant_send_wifi_mgmt_disc_event(void *ctx, int reason_code)
225225
{
226226
struct wpa_supplicant *wpa_s = ctx;
227-
int status = wpas_to_wifi_mgmt_disconn_status(reason_code);
228227
enum net_event_wifi_cmd event;
228+
int status;
229229

230230
if (!wpa_s || !wpa_s->current_ssid) {
231231
return -EINVAL;
232232
}
233233

234234
if (wpa_s->wpa_state >= WPA_COMPLETED) {
235+
/* Disconnect event code & status */
236+
status = wpas_to_wifi_mgmt_disconn_status(reason_code);
235237
if (wpa_s->current_ssid->mode == WPAS_MODE_AP) {
236238
event = NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT;
237239
} else {
238240
event = NET_EVENT_WIFI_CMD_DISCONNECT_RESULT;
239241
}
240242
} else {
243+
/* Connect event code & status */
244+
status = WIFI_STATUS_CONN_FAIL;
241245
if (wpa_s->current_ssid->mode == WPAS_MODE_AP) {
242246
event = NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT;
243247
} else {

0 commit comments

Comments
 (0)