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.
This commit is contained in:
parent
62a0255c1f
commit
6c6ad81f9c
1 changed files with 14 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue