Reinitialize autoscan on explicit reassocciate/reconnect command

This clears the exponential scan interval back to the base value
when a reconnection is requested explicitly.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-06-26 20:05:51 +03:00
parent d7ded75832
commit c3d1223848
3 changed files with 13 additions and 0 deletions

View File

@ -3984,6 +3984,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
eapol_sm_notify_logoff(wpa_s->eapol, TRUE); eapol_sm_notify_logoff(wpa_s->eapol, TRUE);
} else if (os_strcmp(buf, "REASSOCIATE") == 0) { } else if (os_strcmp(buf, "REASSOCIATE") == 0) {
wpa_s->normal_scans = 0; wpa_s->normal_scans = 0;
wpa_supplicant_reinit_autoscan(wpa_s);
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
reply_len = -1; reply_len = -1;
else { else {
@ -3993,6 +3994,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
} }
} else if (os_strcmp(buf, "RECONNECT") == 0) { } else if (os_strcmp(buf, "RECONNECT") == 0) {
wpa_s->normal_scans = 0; wpa_s->normal_scans = 0;
wpa_supplicant_reinit_autoscan(wpa_s);
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
reply_len = -1; reply_len = -1;
else if (wpa_s->disconnected) { else if (wpa_s->disconnected) {

View File

@ -585,6 +585,16 @@ static void wpa_supplicant_stop_autoscan(struct wpa_supplicant *wpa_s)
} }
void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s)
{
if (wpa_s->wpa_state == WPA_DISCONNECTED ||
wpa_s->wpa_state == WPA_SCANNING) {
autoscan_deinit(wpa_s);
wpa_supplicant_start_autoscan(wpa_s);
}
}
/** /**
* 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

View File

@ -598,6 +598,7 @@ void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr); void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s, void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
int sec, int usec); int sec, int usec);
void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
enum wpa_states state); enum wpa_states state);
struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s); struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);