WPS: Added control interface notification for available WPS APs
Whenever new scan results include WPS AP(s) and the client is not associated, send a notification message to control interface monitors. This makes it easier for GUIs to notify the user about possible WPS availability without having to go through the scan results.
This commit is contained in:
parent
484957ae6c
commit
a524f05eb3
4 changed files with 40 additions and 0 deletions
|
@ -49,7 +49,15 @@ extern "C" {
|
|||
/** New scan results available */
|
||||
#define WPA_EVENT_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS "
|
||||
|
||||
/** WPS overlap detected in PBC mode */
|
||||
#define WPS_EVENT_OVERLAP "WPS-OVERLAP-DETECTED "
|
||||
/** Available WPS AP with active PBC found in scan results */
|
||||
#define WPS_EVENT_AP_AVAILABLE_PBC "WPS-AP-AVAILABLE-PBC "
|
||||
/** Available WPS AP with recently selected PIN registrar found in scan results
|
||||
*/
|
||||
#define WPS_EVENT_AP_AVAILABLE_PIN "WPS-AP-AVAILABLE-PIN "
|
||||
/** Available WPS AP found in scan results */
|
||||
#define WPS_EVENT_AP_AVAILABLE "WPS-AP-AVAILABLE "
|
||||
|
||||
/* hostapd control interface - fixed message prefixes */
|
||||
#define WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED "
|
||||
|
|
|
@ -626,6 +626,7 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s)
|
|||
} else {
|
||||
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
|
||||
wpa_supplicant_dbus_notify_scan_results(wpa_s);
|
||||
wpas_wps_notify_scan_results(wpa_s);
|
||||
}
|
||||
|
||||
if (wpa_s->conf->ap_scan == 2 || wpa_s->disconnected)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "eap_peer/eap.h"
|
||||
#include "wpa_supplicant_i.h"
|
||||
#include "eloop.h"
|
||||
#include "wpa_ctrl.h"
|
||||
#include "eap_common/eap_wsc_common.h"
|
||||
#include "wps/wps.h"
|
||||
#include "wps/wps_defs.h"
|
||||
|
@ -558,3 +559,28 @@ int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (wpa_s->disconnected || wpa_s->wpa_state >= WPA_ASSOCIATED)
|
||||
return;
|
||||
|
||||
for (i = 0; i < wpa_s->scan_res->num; i++) {
|
||||
struct wpa_scan_res *bss = wpa_s->scan_res->res[i];
|
||||
struct wpabuf *ie;
|
||||
ie = wpa_scan_get_vendor_ie_multi(bss, WPS_IE_VENDOR_TYPE);
|
||||
if (!ie)
|
||||
continue;
|
||||
if (wps_is_selected_pbc_registrar(ie))
|
||||
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE_PBC);
|
||||
else if (wps_is_selected_pin_registrar(ie))
|
||||
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE_PIN);
|
||||
else
|
||||
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_AP_AVAILABLE);
|
||||
wpabuf_free(ie);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ int wpas_wps_ssid_wildcard_ok(struct wpa_ssid *ssid, struct wpa_scan_res *bss);
|
|||
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);
|
||||
|
||||
#else /* CONFIG_WPS */
|
||||
|
||||
|
@ -72,6 +73,10 @@ static inline int wpas_wps_scan_pbc_overlap(struct wpa_supplicant *wpa_s,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
#endif /* WPS_SUPPLICANT_H */
|
||||
|
|
Loading…
Reference in a new issue