wpa_supplicant: Implement fast-associate on SelectNetwork
If scan results are available when we perform a SelectNetwork, use them to make an associate decision. This can save an entire scan interval-worth of time in situations where something external to wpa_supplicant (like a connection manager) has just previously requested a scan before calling SelectNetwork. Signed-hostap: Paul Stewart <pstew@chromium.org>
This commit is contained in:
parent
9e737f08d4
commit
cecdddc184
4 changed files with 26 additions and 11 deletions
|
@ -1308,6 +1308,26 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
|
|||
#endif /* CONFIG_NO_SCAN_PROCESSING */
|
||||
|
||||
|
||||
int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
#ifdef CONFIG_NO_SCAN_PROCESSING
|
||||
return -1;
|
||||
#else /* CONFIG_NO_SCAN_PROCESSING */
|
||||
struct os_time now;
|
||||
|
||||
if (wpa_s->last_scan_res_used <= 0)
|
||||
return -1;
|
||||
|
||||
os_get_time(&now);
|
||||
if (now.sec - wpa_s->last_scan.sec > 5) {
|
||||
wpa_printf(MSG_DEBUG, "Fast associate: Old scan results");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return wpas_select_network_from_last_scan(wpa_s);
|
||||
#endif /* CONFIG_NO_SCAN_PROCESSING */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WNM
|
||||
|
||||
static void wnm_bss_keep_alive(void *eloop_ctx, void *sock_ctx)
|
||||
|
|
|
@ -54,16 +54,8 @@ static void interworking_reconnect(struct wpa_supplicant *wpa_s)
|
|||
wpa_s->disconnected = 0;
|
||||
wpa_s->reassociate = 1;
|
||||
|
||||
if (wpa_s->last_scan_res_used > 0) {
|
||||
struct os_time now;
|
||||
os_get_time(&now);
|
||||
if (now.sec - wpa_s->last_scan.sec <= 5) {
|
||||
wpa_printf(MSG_DEBUG, "Interworking: Old scan results "
|
||||
"are fresh - connect without new scan");
|
||||
if (wpas_select_network_from_last_scan(wpa_s) >= 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (wpa_supplicant_fast_associate(wpa_s) >= 0)
|
||||
return;
|
||||
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
}
|
||||
|
|
|
@ -1875,7 +1875,9 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
|
|||
wpa_s->connect_without_scan = NULL;
|
||||
wpa_s->disconnected = 0;
|
||||
wpa_s->reassociate = 1;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, disconnected ? 100000 : 0);
|
||||
|
||||
if (wpa_supplicant_fast_associate(wpa_s) != 1)
|
||||
wpa_supplicant_req_scan(wpa_s, 0, disconnected ? 100000 : 0);
|
||||
|
||||
if (ssid)
|
||||
wpas_notify_network_selected(wpa_s, ssid);
|
||||
|
|
|
@ -786,6 +786,7 @@ void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
|
|||
void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
|
||||
void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
|
||||
int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s);
|
||||
int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
|
||||
|
||||
/* eap_register.c */
|
||||
int eap_register_methods(void);
|
||||
|
|
Loading…
Reference in a new issue