wpa_supplicant: Start bgscan on COMPLETED, not ASSOCIATED
Move the code snippet to switch on bgscan over to wpa_supplicant.c from event.c, so that it can be activated on wpa_supplicant_set_state(). Also create a centralized place to switch off bgscan. bgscan is now turned on in COMPLETED, not ASSOCIATED.
This commit is contained in:
parent
87880919ad
commit
cfe53c9aa5
2 changed files with 42 additions and 21 deletions
|
@ -1332,25 +1332,6 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
|
||||||
wpa_s->pending_eapol_rx = NULL;
|
wpa_s->pending_eapol_rx = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_BGSCAN
|
|
||||||
if (wpa_s->current_ssid != wpa_s->bgscan_ssid) {
|
|
||||||
bgscan_deinit(wpa_s);
|
|
||||||
if (wpa_s->current_ssid && wpa_s->current_ssid->bgscan) {
|
|
||||||
if (bgscan_init(wpa_s, wpa_s->current_ssid)) {
|
|
||||||
wpa_dbg(wpa_s, MSG_DEBUG, "Failed to "
|
|
||||||
"initialize bgscan");
|
|
||||||
/*
|
|
||||||
* Live without bgscan; it is only used as a
|
|
||||||
* roaming optimization, so the initial
|
|
||||||
* connection is not affected.
|
|
||||||
*/
|
|
||||||
} else
|
|
||||||
wpa_s->bgscan_ssid = wpa_s->current_ssid;
|
|
||||||
} else
|
|
||||||
wpa_s->bgscan_ssid = NULL;
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_BGSCAN */
|
|
||||||
|
|
||||||
if ((wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
|
if ((wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
|
||||||
wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) &&
|
wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) &&
|
||||||
wpa_s->current_ssid && wpa_drv_get_capa(wpa_s, &capa) == 0 &&
|
wpa_s->current_ssid && wpa_drv_get_capa(wpa_s, &capa) == 0 &&
|
||||||
|
@ -1422,8 +1403,6 @@ static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
|
||||||
wpa_clear_keys(wpa_s, wpa_s->bssid);
|
wpa_clear_keys(wpa_s, wpa_s->bssid);
|
||||||
}
|
}
|
||||||
wpa_supplicant_mark_disassoc(wpa_s);
|
wpa_supplicant_mark_disassoc(wpa_s);
|
||||||
bgscan_deinit(wpa_s);
|
|
||||||
wpa_s->bgscan_ssid = NULL;
|
|
||||||
|
|
||||||
if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME))
|
if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME))
|
||||||
sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid);
|
sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid);
|
||||||
|
|
|
@ -522,6 +522,41 @@ const char * wpa_supplicant_state_txt(enum wpa_states state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_BGSCAN
|
||||||
|
|
||||||
|
static void wpa_supplicant_start_bgscan(struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
if (wpa_s->current_ssid == wpa_s->bgscan_ssid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bgscan_deinit(wpa_s);
|
||||||
|
if (wpa_s->current_ssid && wpa_s->current_ssid->bgscan) {
|
||||||
|
if (bgscan_init(wpa_s, wpa_s->current_ssid)) {
|
||||||
|
wpa_dbg(wpa_s, MSG_DEBUG, "Failed to initialize "
|
||||||
|
"bgscan");
|
||||||
|
/*
|
||||||
|
* Live without bgscan; it is only used as a roaming
|
||||||
|
* optimization, so the initial connection is not
|
||||||
|
* affected.
|
||||||
|
*/
|
||||||
|
} else
|
||||||
|
wpa_s->bgscan_ssid = wpa_s->current_ssid;
|
||||||
|
} else
|
||||||
|
wpa_s->bgscan_ssid = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void wpa_supplicant_stop_bgscan(struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
if (wpa_s->bgscan_ssid != NULL) {
|
||||||
|
bgscan_deinit(wpa_s);
|
||||||
|
wpa_s->bgscan_ssid = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BGSCAN */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpa_supplicant_set_state - Set current connection state
|
* wpa_supplicant_set_state - Set current connection state
|
||||||
* @wpa_s: Pointer to wpa_supplicant data
|
* @wpa_s: Pointer to wpa_supplicant data
|
||||||
|
@ -572,6 +607,13 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
|
||||||
}
|
}
|
||||||
wpa_s->wpa_state = state;
|
wpa_s->wpa_state = state;
|
||||||
|
|
||||||
|
#ifdef CONFIG_BGSCAN
|
||||||
|
if (state == WPA_COMPLETED)
|
||||||
|
wpa_supplicant_start_bgscan(wpa_s);
|
||||||
|
else
|
||||||
|
wpa_supplicant_stop_bgscan(wpa_s);
|
||||||
|
#endif /* CONFIG_BGSCAN */
|
||||||
|
|
||||||
if (wpa_s->wpa_state != old_state) {
|
if (wpa_s->wpa_state != old_state) {
|
||||||
wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state);
|
wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue