diff --git a/src/drivers/driver.h b/src/drivers/driver.h index b6ee6ccc6..def89d003 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1204,6 +1204,9 @@ struct wpa_driver_associate_params { */ int sae_pwe; + /** + * bss_max_idle_period - Maximum idle period which STA currently supports. + */ unsigned short bss_max_idle_period; }; diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 58ed8bc0a..0f8e2f297 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -4430,7 +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->bss_max_idle_period = DEFAULT_BSS_MAX_IDLE_PERIOD; return config; } @@ -5265,6 +5265,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(bss_max_idle_period), 0 }, }; #undef FUNC diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index d22ef05fb..4ce53d6a2 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -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_BSS_MAX_IDLE_PERIOD 300 #include "config_ssid.h" #include "wps/wps.h" @@ -1699,6 +1700,11 @@ struct wpa_config { #endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_PASN*/ + /* + * bss_max_idle_period - Maximum idle period after + * which STA will send keep-alive + */ + unsigned int bss_max_idle_period; }; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 2dd586391..5bf29eccd 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -1559,6 +1559,9 @@ 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->bss_max_idle_period != DEFAULT_BSS_MAX_IDLE_PERIOD) + fprintf(f, "bss_max_idle_period=%u\n", + config->bss_max_idle_period); } #endif /* CONFIG_NO_CONFIG_WRITE */ diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index c4d765b95..5e6218680 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2517,6 +2517,10 @@ static void wnm_process_assoc_resp(struct wpa_supplicant *wpa_s, unsigned int msec; wpa_s->sme.bss_max_idle_period = WPA_GET_LE16(elems.bss_max_idle_period); + wpa_printf(MSG_ERROR, "User config max idle period = %u " + "(*1000 TU)", wpa_s->conf->bss_max_idle_period); + wpa_printf(MSG_ERROR, "AP config max idle period = %u " + "(*1000 TU)", wpa_s->sme.bss_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) ? diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 14f1f0858..02952c1e7 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -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->bss_max_idle_period; if (wpa_drv_associate(wpa_s, ¶ms) < 0) { wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the " "driver failed"); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index dcabdf44c..9afedaa19 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -4020,7 +4020,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->bss_max_idle_period; ret = wpa_drv_associate(wpa_s, ¶ms); os_free(wpa_ie); if (ret < 0) {