Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wifi: WPA supplicant control interface improvements under OOM conditions #13819

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions modules/hostap/src/supp_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ static inline struct wpa_supplicant *get_wpa_s_handle(const struct device *dev)
return z_wpas_get_handle_by_ifname(dev->name);
}

#define WPA_SUPP_STATE_POLLING_MS 10
static int wait_for_disconnect_complete(const struct device *dev)
{
int ret = 0;
int timeout = 0;
int attempts = 0;
struct wpa_supplicant *wpa_s = get_wpa_s_handle(dev);
unsigned int max_attempts = DISCONNECT_TIMEOUT_MS / WPA_SUPP_STATE_POLLING_MS;

if (!wpa_s) {
ret = -ENODEV;
Expand All @@ -88,13 +90,12 @@ static int wait_for_disconnect_complete(const struct device *dev)
}

while (wpa_s->wpa_state != WPA_DISCONNECTED) {
if (timeout > DISCONNECT_TIMEOUT_MS) {
if (attempts++ > max_attempts) {
ret = -ETIMEDOUT;
wpa_printf(MSG_WARNING, "Failed to disconnect from network");
break;
}
k_sleep(K_MSEC(10));
timeout++;
k_sleep(K_MSEC(WPA_SUPP_STATE_POLLING_MS));
}
out:
return ret;
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ manifest:
- name: hostap
repo-path: sdk-hostap
path: modules/lib/hostap
revision: 04454972385783830a756c52127e722373b62f26
revision: ecebc52715feb1605b7aab0cb13004be287db884
userdata:
ncs:
upstream-url: https://w1.fi/cgit/hostap/
Expand Down
Loading