Skip to content

[noup] zephyr: Set max idle period #30

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions wpa_supplicant/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -4430,6 +4430,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
if (driver_param)
config->driver_param = os_strdup(driver_param);
config->gas_rand_addr_lifetime = DEFAULT_RAND_ADDR_LIFETIME;
config->max_idle_period = DEFAULT_MAX_IDLE_PERIOD;

return config;
}
Expand Down Expand Up @@ -5265,6 +5266,7 @@ static const struct global_parse_data global_fields[] = {
{ INT_RANGE(pasn_corrupt_mic, 0, 1), 0 },
#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_PASN */
{ INT(max_idle_period), 0 },
};

#undef FUNC
Expand Down
5 changes: 5 additions & 0 deletions wpa_supplicant/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#define DEFAULT_OCE_SUPPORT OCE_STA
#define DEFAULT_EXTENDED_KEY_ID 0
#define DEFAULT_SCAN_RES_VALID_FOR_CONNECT 5
#define DEFAULT_MAX_IDLE_PERIOD 300

#include "config_ssid.h"
#include "wps/wps.h"
Expand Down Expand Up @@ -1699,6 +1700,10 @@ struct wpa_config {

#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_PASN*/
/**
* max_idle_period - Maximum idle period after which STA will send keep-alive
*/
unsigned int max_idle_period;
};


Expand Down
2 changes: 2 additions & 0 deletions wpa_supplicant/config_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
if (config->wowlan_disconnect_on_deinit)
fprintf(f, "wowlan_disconnect_on_deinit=%d\n",
config->wowlan_disconnect_on_deinit);
if (config->max_idle_period != DEFAULT_MAX_IDLE_PERIOD)
fprintf(f, "max_idle_period=%u\n", config->max_idle_period);
}

#endif /* CONFIG_NO_CONFIG_WRITE */
Expand Down
11 changes: 9 additions & 2 deletions wpa_supplicant/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -2515,8 +2515,15 @@ static void wnm_process_assoc_resp(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_SME
if (elems.bss_max_idle_period) {
unsigned int msec;
wpa_s->sme.bss_max_idle_period =
WPA_GET_LE16(elems.bss_max_idle_period);

if (wpa_s->conf->max_idle_period >=
WPA_GET_LE16(elems.bss_max_idle_period)) {
wpa_s->sme.bss_max_idle_period =
WPA_GET_LE16(elems.bss_max_idle_period);
} else {
wpa_s->sme.bss_max_idle_period = wpa_s->conf->max_idle_period;
}

wpa_printf(MSG_DEBUG, "WNM: BSS Max Idle Period: %u (* 1000 "
"TU)%s", wpa_s->sme.bss_max_idle_period,
(elems.bss_max_idle_period[2] & 0x01) ?
Expand Down
2 changes: 1 addition & 1 deletion wpa_supplicant/sme.c
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
else
params.uapsd = -1;

params.bss_max_idle_period = CONFIG_BSS_MAX_IDLE_TIME;
params.bss_max_idle_period = wpa_s->conf->max_idle_period;
if (wpa_drv_associate(wpa_s, &params) < 0) {
wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the "
"driver failed");
Expand Down
2 changes: 1 addition & 1 deletion wpa_supplicant/wpa_supplicant.c
Original file line number Diff line number Diff line change
Expand Up @@ -4019,7 +4019,7 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
params.sae_pwe = wpa_s->conf->sae_pwe;
#endif /* CONFIG_SAE */

params.bss_max_idle_period = CONFIG_BSS_MAX_IDLE_TIME;
params.bss_max_idle_period = wpa_s->conf->max_idle_period;
ret = wpa_drv_associate(wpa_s, &params);
os_free(wpa_ie);
if (ret < 0) {
Expand Down