WPS: Added support for wildcard SSID matching in ap_scan=2 mode

Change association behavior to match with ap_scan=1 when WPS is used in
ap_scan=2 mode with wildcard SSID matching. In addition, allow hardcoded
BSSID to be used to select AP even if selected registrar attribute is
not present.
This commit is contained in:
Jouni Malinen 2008-12-20 22:55:02 +02:00
parent 3c1e276507
commit 24c23d1b3c
4 changed files with 47 additions and 1 deletions

View file

@ -629,7 +629,8 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s)
wpas_wps_notify_scan_results(wpa_s);
}
if (wpa_s->conf->ap_scan == 2 || wpa_s->disconnected)
if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s)) ||
wpa_s->disconnected)
return;
while (selected == NULL) {

View file

@ -935,6 +935,17 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
wpa_ft_prepare_auth_request(wpa_s->wpa);
}
#endif /* CONFIG_IEEE80211R */
#ifdef CONFIG_WPS
} else if ((ssid->ssid == NULL || ssid->ssid_len == 0) &&
wpa_s->conf->ap_scan == 2 &&
(ssid->key_mgmt & WPA_KEY_MGMT_WPS)) {
/* Use ap_scan==1 style network selection to find the network
*/
wpa_s->scan_req = 2;
wpa_s->reassociate = 1;
wpa_supplicant_req_scan(wpa_s, 0, 0);
return;
#endif /* CONFIG_WPS */
} else {
wpa_msg(wpa_s, MSG_INFO, "Trying to associate with SSID '%s'",
wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
@ -1418,6 +1429,14 @@ struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s)
(!entry->bssid_set ||
os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
return entry;
#ifdef CONFIG_WPS
if (!entry->disabled &&
(entry->key_mgmt & WPA_KEY_MGMT_WPS) &&
(entry->ssid == NULL || entry->ssid_len == 0) &&
(!entry->bssid_set ||
os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
return entry;
#endif /* CONFIG_WPS */
entry = entry->next;
}

View file

@ -286,6 +286,7 @@ static struct wpa_ssid * wpas_wps_add_network(struct wpa_supplicant *wpa_s,
struct wpa_scan_res *res;
os_memcpy(ssid->bssid, bssid, ETH_ALEN);
ssid->bssid_set = 1;
/* Try to get SSID from scan results */
if (wpa_s->scan_res == NULL &&
@ -538,6 +539,12 @@ int wpas_wps_ssid_wildcard_ok(struct wpa_ssid *ssid,
}
}
if (!ret && ssid->bssid_set &&
os_memcmp(ssid->bssid, bss->bssid, ETH_ALEN) == 0) {
/* allow wildcard SSID due to hardcoded BSSID match */
ret = 1;
}
wpabuf_free(wps_ie);
return ret;
@ -629,3 +636,16 @@ void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
break;
}
}
int wpas_wps_searching(struct wpa_supplicant *wpa_s)
{
struct wpa_ssid *ssid;
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && !ssid->disabled)
return 1;
}
return 0;
}

View file

@ -32,6 +32,7 @@ int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
struct wpa_scan_res *selected,
struct wpa_ssid *ssid);
void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s);
int wpas_wps_searching(struct wpa_supplicant *wpa_s);
#else /* CONFIG_WPS */
@ -77,6 +78,11 @@ static inline void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
{
}
static inline int wpas_wps_searching(struct wpa_supplicant *wpa_s)
{
return 0;
}
#endif /* CONFIG_WPS */
#endif /* WPS_SUPPLICANT_H */