aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-12-20 20:55:02 (GMT)
committerJouni Malinen <j@w1.fi>2008-12-20 20:55:02 (GMT)
commit24c23d1b3c3c4e04a7039cd721b3cd12f5af98e9 (patch)
treefb584091301bf6d014130626cc56f6e2c4cf3f66 /wpa_supplicant
parent3c1e276507a3c0c8c489afb3ee1fe9bd8f7c0e31 (diff)
downloadhostap-06-24c23d1b3c3c4e04a7039cd721b3cd12f5af98e9.zip
hostap-06-24c23d1b3c3c4e04a7039cd721b3cd12f5af98e9.tar.gz
hostap-06-24c23d1b3c3c4e04a7039cd721b3cd12f5af98e9.tar.bz2
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.
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/events.c3
-rw-r--r--wpa_supplicant/wpa_supplicant.c19
-rw-r--r--wpa_supplicant/wps_supplicant.c20
-rw-r--r--wpa_supplicant/wps_supplicant.h6
4 files changed, 47 insertions, 1 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index b3c414a..32b87e9 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -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) {
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index cbe466c..6701f84 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -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;
}
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 1ceabc9..c326fea 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -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;
+}
diff --git a/wpa_supplicant/wps_supplicant.h b/wpa_supplicant/wps_supplicant.h
index f781dea..248f25f 100644
--- a/wpa_supplicant/wps_supplicant.h
+++ b/wpa_supplicant/wps_supplicant.h
@@ -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 */