aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2012-05-16 15:41:04 +0300
committerArik Nemtsov <arik@wizery.com>2012-08-02 13:03:07 +0300
commitdb520b6dcea24d031a7f8ab15c582d5c8393673f (patch)
tree543f927b4848b81690b8acf3ee3ab73f8eda1045 /wpa_supplicant
parent3eb6d0af511abbe2dd66b3aee3c54609d9fe571d (diff)
downloadexternal_wpa_supplicant_8_ti-db520b6dcea24d031a7f8ab15c582d5c8393673f.zip
external_wpa_supplicant_8_ti-db520b6dcea24d031a7f8ab15c582d5c8393673f.tar.gz
external_wpa_supplicant_8_ti-db520b6dcea24d031a7f8ab15c582d5c8393673f.tar.bz2
Disconnect if we can't roam following beacon loss
The driver reports the 1st beacon loss event but doesn't disconnect until further consecutive beacon loss events are received. That's being done in order to give the supplicant time to roam seamlessly (i.e. without reporting DISCONNECTED to upper layers). However, in case we can't find any roaming candidates it's better to disconnect as soon as possible so any supplicant client will be able to switch quickly to another communication channel (e.g. mobile 3G). This change initiates up to two immediate specific SSID scans on all channels following a beacon loss in order to locate a roaming candidate. Two scans are performed in case a roaming candidate was preivously blacklisted. That way, it'll be explored if there's no other option. Signed-off-by: Eyal Shapira <eyal@wizery.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/events.c18
-rw-r--r--wpa_supplicant/scan.c12
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h1
3 files changed, 29 insertions, 2 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 42c8793..06b1b56 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1186,6 +1186,21 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
} else {
int timeout_sec = wpa_s->scan_interval;
int timeout_usec = 0;
+
+ if (wpa_s->roaming && (wpa_s->num_roaming_scans > 1)) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "No roaming candidate"
+ " found. Attempt another scan");
+ wpa_s->num_roaming_scans--;
+ wpa_supplicant_req_new_scan(wpa_s, 0, 0);
+ return 0;
+ } else if (wpa_s->roaming) {
+ wpa_dbg(wpa_s, MSG_DEBUG,
+ "No roaming candidate found "
+ "after multiple scans. Disconnect");
+ wpa_supplicant_deauthenticate(wpa_s,
+ WLAN_REASON_DEAUTH_LEAVING);
+ /* Fall through so periodic scan won't stop */
+ }
#ifdef CONFIG_P2P
if (wpas_p2p_scan_no_go_seen(wpa_s) == 1)
return 0;
@@ -2352,6 +2367,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
locally_generated,
data->deauth_info.addr);
}
+
+ wpa_s->roaming = 0;
break;
case EVENT_MICHAEL_MIC_FAILURE:
wpa_supplicant_event_michael_mic_failure(wpa_s, data);
@@ -2735,6 +2752,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
case EVENT_START_ROAMING:
if (!is_zero_ether_addr(wpa_s->bssid)) {
wpa_s->roaming = 1;
+ wpa_s->num_roaming_scans = 2;
wpa_supplicant_req_scan(wpa_s, 0, 0);
}
break;
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index eb5214f..8d0adab 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -522,6 +522,15 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
}
#endif /* CONFIG_P2P */
+ if (wpa_s->roaming && wpa_s->current_ssid) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "Use specific SSID for scan during "
+ "roaming candidate search");
+ params.ssids[0].ssid = wpa_s->current_ssid->ssid;
+ params.ssids[0].ssid_len = wpa_s->current_ssid->ssid_len;
+ params.num_ssids = 1;
+ goto ssid_list_set;
+ }
+
/* Find the starting point from which to continue scanning */
ssid = wpa_s->conf->ssid;
if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) {
@@ -618,9 +627,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
wpa_dbg(wpa_s, MSG_DEBUG, "Starting AP scan for wildcard "
"SSID");
}
-#ifdef CONFIG_P2P
+
ssid_list_set:
-#endif /* CONFIG_P2P */
wpa_supplicant_optimize_freqs(wpa_s, &params);
extra_ie = wpa_supplicant_extra_ies(wpa_s, &params);
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index fb858da..02b3a99 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -291,6 +291,7 @@ struct wpa_supplicant {
int reassociate; /* reassociation requested */
int roaming; /* roaming requested */
+ int num_roaming_scans;
int disconnected; /* all connections disabled; i.e., do no reassociate
* before this has been cleared */
struct wpa_ssid *current_ssid;