aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-12-15 18:09:57 (GMT)
committerJouni Malinen <j@w1.fi>2008-12-15 18:09:57 (GMT)
commita524f05eb3cfefea94fe27f039f78a278a4ff5af (patch)
treedb41d94e0d7a45cc6aa70fd9d67965da12c54992 /wpa_supplicant
parent484957ae6c88cd33946e8677b1306530657b32b6 (diff)
downloadhostap-06-a524f05eb3cfefea94fe27f039f78a278a4ff5af.zip
hostap-06-a524f05eb3cfefea94fe27f039f78a278a4ff5af.tar.gz
hostap-06-a524f05eb3cfefea94fe27f039f78a278a4ff5af.tar.bz2
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.
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/events.c1
-rw-r--r--wpa_supplicant/wps_supplicant.c26
-rw-r--r--wpa_supplicant/wps_supplicant.h5
3 files changed, 32 insertions, 0 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a1bd2ba..b3c414a 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -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)
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 131506f..8c254df 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -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;
+ }
+}
diff --git a/wpa_supplicant/wps_supplicant.h b/wpa_supplicant/wps_supplicant.h
index bdde6ab..f781dea 100644
--- a/wpa_supplicant/wps_supplicant.h
+++ b/wpa_supplicant/wps_supplicant.h
@@ -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 */