wpa_supplicant: improve scan cache reliability

SVN-Revision: 11930
This commit is contained in:
Felix Fietkau 2008-07-25 22:37:36 +00:00
parent 144e506288
commit e7c5e72479

View file

@ -1,9 +1,7 @@
Add a scan result cache to improve roaming speed if the driver gave us a background scan before losing the connection. Add a scan result cache to improve roaming speed if the driver gave us a background scan before losing the connection.
Index: wpa_supplicant-0.6.3/wpa_supplicant/config.h --- a/wpa_supplicant/config.h
=================================================================== +++ b/wpa_supplicant/config.h
--- wpa_supplicant-0.6.3.orig/wpa_supplicant/config.h 2008-02-23 03:45:24.000000000 +0100
+++ wpa_supplicant-0.6.3/wpa_supplicant/config.h 2008-07-10 15:08:21.000000000 +0200
@@ -97,6 +97,12 @@ @@ -97,6 +97,12 @@
int ap_scan; int ap_scan;
@ -17,10 +15,8 @@ Index: wpa_supplicant-0.6.3/wpa_supplicant/config.h
* ctrl_interface - Parameters for the control interface * ctrl_interface - Parameters for the control interface
* *
* If this is specified, %wpa_supplicant will open a control interface * If this is specified, %wpa_supplicant will open a control interface
Index: wpa_supplicant-0.6.3/wpa_supplicant/config_file.c --- a/wpa_supplicant/config_file.c
=================================================================== +++ b/wpa_supplicant/config_file.c
--- wpa_supplicant-0.6.3.orig/wpa_supplicant/config_file.c 2008-02-23 03:45:24.000000000 +0100
+++ wpa_supplicant-0.6.3/wpa_supplicant/config_file.c 2008-07-10 15:59:38.000000000 +0200
@@ -312,6 +312,13 @@ @@ -312,6 +312,13 @@
return 0; return 0;
} }
@ -54,10 +50,8 @@ Index: wpa_supplicant-0.6.3/wpa_supplicant/config_file.c
if (config->fast_reauth != DEFAULT_FAST_REAUTH) if (config->fast_reauth != DEFAULT_FAST_REAUTH)
fprintf(f, "fast_reauth=%d\n", config->fast_reauth); fprintf(f, "fast_reauth=%d\n", config->fast_reauth);
#ifdef EAP_TLS_OPENSSL #ifdef EAP_TLS_OPENSSL
Index: wpa_supplicant-0.6.3/wpa_supplicant/events.c --- a/wpa_supplicant/events.c
=================================================================== +++ b/wpa_supplicant/events.c
--- wpa_supplicant-0.6.3.orig/wpa_supplicant/events.c 2008-07-10 13:27:03.000000000 +0200
+++ wpa_supplicant-0.6.3/wpa_supplicant/events.c 2008-07-10 17:18:53.000000000 +0200
@@ -555,6 +555,9 @@ @@ -555,6 +555,9 @@
if (wpa_s->conf->ap_scan == 2 || wpa_s->disconnected) if (wpa_s->conf->ap_scan == 2 || wpa_s->disconnected)
return; return;
@ -68,12 +62,20 @@ Index: wpa_supplicant-0.6.3/wpa_supplicant/events.c
while (selected == NULL) { while (selected == NULL) {
for (prio = 0; prio < wpa_s->conf->num_prio; prio++) { for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
selected = wpa_supplicant_select_bss( selected = wpa_supplicant_select_bss(
@@ -594,13 +597,16 @@ @@ -567,6 +570,7 @@
wpa_printf(MSG_DEBUG, "No APs found - clear blacklist "
"and try again");
wpa_blacklist_clear(wpa_s);
+ memset(&wpa_s->last_scan_results, 0, sizeof(wpa_s->last_scan_results));
} else if (selected == NULL) {
break;
}
@@ -594,10 +598,12 @@
rsn_preauth_scan_results(wpa_s->wpa, wpa_s->scan_res); rsn_preauth_scan_results(wpa_s->wpa, wpa_s->scan_res);
} else { } else {
wpa_printf(MSG_DEBUG, "No suitable AP found."); wpa_printf(MSG_DEBUG, "No suitable AP found.");
- timeout = 5; - timeout = 5;
+ timeout = 1; + timeout = 0;
goto req_scan; goto req_scan;
} }
@ -82,10 +84,6 @@ Index: wpa_supplicant-0.6.3/wpa_supplicant/events.c
return; return;
req_scan: req_scan:
+ memset(&wpa_s->last_scan_results, 0, sizeof(wpa_s->last_scan_results));
if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1) {
/*
* Quick recovery if the initial scan results were not
@@ -804,6 +810,9 @@ @@ -804,6 +810,9 @@
} }
if (wpa_s->wpa_state >= WPA_ASSOCIATED) if (wpa_s->wpa_state >= WPA_ASSOCIATED)
@ -96,10 +94,8 @@ Index: wpa_supplicant-0.6.3/wpa_supplicant/events.c
bssid = wpa_s->bssid; bssid = wpa_s->bssid;
if (os_memcmp(bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0) if (os_memcmp(bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0)
bssid = wpa_s->pending_bssid; bssid = wpa_s->pending_bssid;
Index: wpa_supplicant-0.6.3/wpa_supplicant/wpa_supplicant_i.h --- a/wpa_supplicant/wpa_supplicant_i.h
=================================================================== +++ b/wpa_supplicant/wpa_supplicant_i.h
--- wpa_supplicant-0.6.3.orig/wpa_supplicant/wpa_supplicant_i.h 2008-07-10 15:03:56.000000000 +0200
+++ wpa_supplicant-0.6.3/wpa_supplicant/wpa_supplicant_i.h 2008-07-10 15:16:17.000000000 +0200
@@ -334,6 +334,7 @@ @@ -334,6 +334,7 @@
struct wpa_client_mlme mlme; struct wpa_client_mlme mlme;
int use_client_mlme; int use_client_mlme;
@ -116,10 +112,8 @@ Index: wpa_supplicant-0.6.3/wpa_supplicant/wpa_supplicant_i.h
void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s); void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
/* events.c */ /* events.c */
Index: wpa_supplicant-0.6.3/wpa_supplicant/scan.c --- a/wpa_supplicant/scan.c
=================================================================== +++ b/wpa_supplicant/scan.c
--- wpa_supplicant-0.6.3.orig/wpa_supplicant/scan.c 2008-07-10 13:27:03.000000000 +0200
+++ wpa_supplicant-0.6.3/wpa_supplicant/scan.c 2008-07-10 16:24:31.000000000 +0200
@@ -40,6 +40,18 @@ @@ -40,6 +40,18 @@
wpa_supplicant_event(wpa_s, EVENT_ASSOC, &data); wpa_supplicant_event(wpa_s, EVENT_ASSOC, &data);
} }
@ -151,10 +145,8 @@ Index: wpa_supplicant-0.6.3/wpa_supplicant/scan.c
wpa_s->scan_res_tried++; wpa_s->scan_res_tried++;
wpa_printf(MSG_DEBUG, "Trying to get current scan results " wpa_printf(MSG_DEBUG, "Trying to get current scan results "
"first without requesting a new scan to speed up " "first without requesting a new scan to speed up "
Index: wpa_supplicant-0.6.3/wpa_supplicant/wpa_supplicant.c --- a/wpa_supplicant/wpa_supplicant.c
=================================================================== +++ b/wpa_supplicant/wpa_supplicant.c
--- wpa_supplicant-0.6.3.orig/wpa_supplicant/wpa_supplicant.c 2008-07-10 14:41:16.000000000 +0200
+++ wpa_supplicant-0.6.3/wpa_supplicant/wpa_supplicant.c 2008-07-10 18:45:59.000000000 +0200
@@ -1417,6 +1417,9 @@ @@ -1417,6 +1417,9 @@
{ {
struct wpa_supplicant *wpa_s = ctx; struct wpa_supplicant *wpa_s = ctx;