aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2011-01-05 09:49:03 (GMT)
committerJouni Malinen <j@w1.fi>2011-01-05 09:49:03 (GMT)
commit6c6ad81f9c46d8e1d958feaa38fa105b186ee861 (patch)
tree3204c1af0ae7de67cb481daa66e09b34e180a20b /wpa_supplicant/wps_supplicant.c
parent62a0255c1fc74e7ec6559bb2bd5c85b7814e769a (diff)
downloadhostap-6c6ad81f9c46d8e1d958feaa38fa105b186ee861.zip
hostap-6c6ad81f9c46d8e1d958feaa38fa105b186ee861.tar.gz
hostap-6c6ad81f9c46d8e1d958feaa38fa105b186ee861.tar.bz2
WPS: Make WPS-AP-AVAILABLE* events a bit more consistent
The BSS table entries may be in more or less random order and it is better to show the most likely WPS configuration method in a way that is somewhat more consistent instead of just showing the method of the first BSS entry found in the table.
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index a5770f1..6dfea2f 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1297,6 +1297,7 @@ int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
{
struct wpa_bss *bss;
+ unsigned int pbc = 0, auth = 0, pin = 0, wps = 0;
if (wpa_s->disconnected || wpa_s->wpa_state >= WPA_ASSOCIATED)
return;
@@ -1307,20 +1308,24 @@ void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
if (!ie)
continue;
if (wps_is_selected_pbc_registrar(ie))
- wpa_msg_ctrl(wpa_s, MSG_INFO,
- WPS_EVENT_AP_AVAILABLE_PBC);
+ pbc++;
else if (wps_is_addr_authorized(ie, wpa_s->own_addr, 0))
- wpa_msg_ctrl(wpa_s, MSG_INFO,
- WPS_EVENT_AP_AVAILABLE_AUTH);
+ auth++;
else if (wps_is_selected_pin_registrar(ie))
- wpa_msg_ctrl(wpa_s, MSG_INFO,
- WPS_EVENT_AP_AVAILABLE_PIN);
+ pin++;
else
- wpa_msg_ctrl(wpa_s, MSG_INFO,
- WPS_EVENT_AP_AVAILABLE);
+ wps++;
wpabuf_free(ie);
- break;
}
+
+ if (pbc)
+ wpa_msg_ctrl(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE_PBC);
+ else if (auth)
+ wpa_msg_ctrl(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE_AUTH);
+ else if (pin)
+ wpa_msg_ctrl(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE_PIN);
+ else if (wps)
+ wpa_msg_ctrl(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE);
}