diff options
author | Jouni Malinen <j@w1.fi> | 2009-09-15 00:08:24 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2009-09-15 00:08:24 +0300 |
commit | 60b94c9819199c0427e623080ebae27fe44be6b5 (patch) | |
tree | 6f8ccef606126a46a2097fdd42b2a9b81601c1cf /wpa_supplicant/scan.c | |
parent | 3180d7a2088fdd429c2eb9ae74abfa96e6a9b9b0 (diff) | |
download | external_wpa_supplicant_8_ti-60b94c9819199c0427e623080ebae27fe44be6b5.zip external_wpa_supplicant_8_ti-60b94c9819199c0427e623080ebae27fe44be6b5.tar.gz external_wpa_supplicant_8_ti-60b94c9819199c0427e623080ebae27fe44be6b5.tar.bz2 |
Add preliminary background scan and roaming module design
This allows background scanning and roaming decisions to be contained in
a single place based on a defined set of notification events which will
hopefully make it easier to experiment with roaming improvements. In
addition, this allows multiple intra-ESS roaming policies to be used
(each network configuration block can configure its own bgscan module).
The beacon loss and signal strength notifications are implemented for
the bgscan API, but the actual events are not yet available from the
driver.
The included sample bgscan module ("simple") is an example of what can
be done with the new bgscan mechanism. It requests periodic background
scans when the device remains associated with an ESS and has couple of
notes on what a more advanced bgscan module could do to optimize
background scanning and roaming. The periodic scans will cause the scan
result handler to pick a better AP if one becomes available. This bgscan
module can be taken into use by adding bgscan="simple" (or
bgscan="simple:<bgscan interval in seconds>") into the network
configuration block.
Diffstat (limited to 'wpa_supplicant/scan.c')
-rw-r--r-- | wpa_supplicant/scan.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index e122e67..b39b8ee 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -178,6 +178,34 @@ static void int_array_sort_unique(int *a) } +int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s, + struct wpa_driver_scan_params *params) +{ + int ret; + + wpa_supplicant_notify_scanning(wpa_s, 1); + + if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) { + ieee80211_sta_set_probe_req_ie(wpa_s, params->extra_ies, + params->extra_ies_len); + ret = ieee80211_sta_req_scan(wpa_s, params->ssids[0].ssid, + params->ssids[0].ssid_len); + } else { + wpa_drv_set_probe_req_ie(wpa_s, params->extra_ies, + params->extra_ies_len); + ret = wpa_drv_scan(wpa_s, params); + } + + if (ret) { + wpa_supplicant_notify_scanning(wpa_s, 0); + wpas_notify_scan_done(wpa_s, 0); + } else + wpa_s->scan_runs++; + + return ret; +} + + static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) { struct wpa_supplicant *wpa_s = eloop_ctx; @@ -335,26 +363,13 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) } #endif /* CONFIG_WPS */ - wpa_supplicant_notify_scanning(wpa_s, 1); - - if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) { - ieee80211_sta_set_probe_req_ie(wpa_s, params.extra_ies, - params.extra_ies_len); - ret = ieee80211_sta_req_scan(wpa_s, params.ssids[0].ssid, - params.ssids[0].ssid_len); - } else { - wpa_drv_set_probe_req_ie(wpa_s, params.extra_ies, - params.extra_ies_len); - ret = wpa_drv_scan(wpa_s, ¶ms); - } + ret = wpa_supplicant_trigger_scan(wpa_s, ¶ms); wpabuf_free(wps_ie); os_free(params.freqs); if (ret) { wpa_printf(MSG_WARNING, "Failed to initiate AP scan."); - wpa_supplicant_notify_scanning(wpa_s, 0); - wpas_notify_scan_done(wpa_s, 0); wpa_supplicant_req_scan(wpa_s, 10, 0); } else wpa_s->scan_runs++; |