Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
[nrf noup] zephyr: Fix sending unsolicited disconnect result
Browse files Browse the repository at this point in the history
fixup! [nrf noup] Monitor supplicant state and inform applications

If STA is not connected but still disassociated for some reason e.g.,
wrong password, sending disconnect results is not intuitive as we have
never sent connected status up, so, instead just send connect result
with the reason code for failure.

Fixes SHEL-2265.

Signed-off-by: Chaitanya Tata <[email protected]>
  • Loading branch information
krish2718 committed Dec 8, 2023
1 parent 6e26b99 commit 006334c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wpa_supplicant/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -3599,8 +3599,13 @@ static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
MAC2STR(bssid), reason_code,
locally_generated ? " locally_generated=1" : "");
#ifdef CONFIG_ZEPHYR
int status = 0;
send_wifi_mgmt_event(wpa_s->ifname, NET_EVENT_WIFI_CMD_DISCONNECT_RESULT, (void *)&status, sizeof(int));
int status = reason_code;

if (wpa_s->wpa_state >= WPA_COMPLETED) {
send_wifi_mgmt_event(wpa_s->ifname, NET_EVENT_WIFI_CMD_DISCONNECT_RESULT, (void *)&status, sizeof(int));
} else {
send_wifi_mgmt_event(wpa_s->ifname, NET_EVENT_WIFI_CMD_CONNECT_RESULT, (void *)&status, sizeof(int));
}
#endif /* CONFIG_ZEPHYR */
}
}
Expand Down

0 comments on commit 006334c

Please sign in to comment.