P2P: Start GO without extra scan step

There are some corner cases, where the wpa_supplicant_req_scan() call
may end up scheduling a scan even if we are about to start a GO. Avoid
this by explicitly marking the GO network to be selected for the next
connection.
This commit is contained in:
Jouni Malinen 2011-06-21 11:47:03 +03:00 committed by Jouni Malinen
parent a6efc65ddb
commit 7dcdcfd68d
4 changed files with 19 additions and 5 deletions

View file

@ -926,7 +926,7 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s,
wpa_s->ap_configured_cb = p2p_go_configured; wpa_s->ap_configured_cb = p2p_go_configured;
wpa_s->ap_configured_cb_ctx = wpa_s; wpa_s->ap_configured_cb_ctx = wpa_s;
wpa_s->ap_configured_cb_data = wpa_s->go_params; wpa_s->ap_configured_cb_data = wpa_s->go_params;
wpa_s->connect_without_scan = 1; wpa_s->connect_without_scan = ssid;
wpa_s->reassociate = 1; wpa_s->reassociate = 1;
wpa_s->disconnected = 0; wpa_s->disconnected = 0;
wpa_supplicant_req_scan(wpa_s, 0, 0); wpa_supplicant_req_scan(wpa_s, 0, 0);

View file

@ -307,6 +307,20 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
wpa_s->wpa_state == WPA_INACTIVE) wpa_s->wpa_state == WPA_INACTIVE)
wpa_supplicant_set_state(wpa_s, WPA_SCANNING); wpa_supplicant_set_state(wpa_s, WPA_SCANNING);
if (scan_req != 2 && wpa_s->connect_without_scan) {
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
if (ssid == wpa_s->connect_without_scan)
break;
}
wpa_s->connect_without_scan = NULL;
if (ssid) {
wpa_printf(MSG_DEBUG, "Start a pre-selected network "
"without scan step");
wpa_supplicant_associate(wpa_s, NULL, ssid);
return;
}
}
/* Find the starting point from which to continue scanning */ /* Find the starting point from which to continue scanning */
ssid = wpa_s->conf->ssid; ssid = wpa_s->conf->ssid;
if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) { if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) {
@ -319,9 +333,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
} }
} }
if (scan_req != 2 && (wpa_s->conf->ap_scan == 2 || if (scan_req != 2 && wpa_s->conf->ap_scan == 2) {
wpa_s->connect_without_scan)) { wpa_s->connect_without_scan = NULL;
wpa_s->connect_without_scan = 0;
wpa_supplicant_assoc_try(wpa_s, ssid); wpa_supplicant_assoc_try(wpa_s, ssid);
return; return;
} else if (wpa_s->conf->ap_scan == 2) { } else if (wpa_s->conf->ap_scan == 2) {

View file

@ -1634,6 +1634,7 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
if (was_disabled != other_ssid->disabled) if (was_disabled != other_ssid->disabled)
wpas_notify_network_enabled_changed(wpa_s, other_ssid); wpas_notify_network_enabled_changed(wpa_s, other_ssid);
} }
wpa_s->connect_without_scan = NULL;
wpa_s->disconnected = 0; wpa_s->disconnected = 0;
wpa_s->reassociate = 1; wpa_s->reassociate = 1;
wpa_supplicant_req_scan(wpa_s, 0, 0); wpa_supplicant_req_scan(wpa_s, 0, 0);

View file

@ -549,7 +549,7 @@ struct wpa_supplicant {
const struct bgscan_ops *bgscan; const struct bgscan_ops *bgscan;
void *bgscan_priv; void *bgscan_priv;
int connect_without_scan; struct wpa_ssid *connect_without_scan;
int after_wps; int after_wps;
unsigned int wps_freq; unsigned int wps_freq;